--> Snack (beeCrowd- 1038) URI 1038 solution C, Python | Alpha Codist

Search This Blog

Snack (beeCrowd- 1038) URI 1038 solution C, Python

Snack beeCrowd 1038 URI solution C Python problem solved bee neilor tonin brazil list uri judge language printf print stdio.h input scanf % x y count

Snack

Snack beeCrowd 1038 URI solution C Python problem solved bee neilor tonin brazil list uri judge language printf print stdio.h input scanf % x y count

The formula is:

  1. Take input. 
  2. Create a list of prices. This list will contain the prices for the items.
  3. Now using (X-1) as an index get the prices of items and multiply them by Y.
  4. Print the value.

The solution in C:


#include <stdio.h>

int main() {
 
    int x,y;
    scanf("%d %d",&x,&y);
    double prices[5] = {4.00,4.50,5.00,2.00,1.50};
    double total = prices[x-1]*y;
    printf("Total: R$ %0.2f\n",total);
 
    return 0;
}


The solution in Python:


x, y = map(int, input().split())
prices = [4.00,4.50,5.00,2.00,1.50]
total = prices[x-1]*y;
print("Total: R$ %0.2f"%total);

COMMENTS

Name

beeCrowd,11,C,10,Computer,9,Downloads,3,HTML,1,My Creation,2,Python,24,Python-Soft,1,Shooting,2,
ltr
item
Alpha Codist: Snack (beeCrowd- 1038) URI 1038 solution C, Python
Snack (beeCrowd- 1038) URI 1038 solution C, Python
Snack beeCrowd 1038 URI solution C Python problem solved bee neilor tonin brazil list uri judge language printf print stdio.h input scanf % x y count
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE9nIgBIU4TPmYYj34G0IP0seO4DnU0Qgo64T9xC8PUn5msQuqd0dUsnngr9-_t4xkqqqluiI4P_0cMtI8PEgiAlbKvYU9F_Ey79L_fD8IkZxxdMEtFeNWNgqL3BzYt4Zof-V8OpamFlKwnDx1tWdDSxnMg_WcW6ZVajF2r7TC2Mrcs-RuRovbx3hxBg/w640-h422/1038.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE9nIgBIU4TPmYYj34G0IP0seO4DnU0Qgo64T9xC8PUn5msQuqd0dUsnngr9-_t4xkqqqluiI4P_0cMtI8PEgiAlbKvYU9F_Ey79L_fD8IkZxxdMEtFeNWNgqL3BzYt4Zof-V8OpamFlKwnDx1tWdDSxnMg_WcW6ZVajF2r7TC2Mrcs-RuRovbx3hxBg/s72-w640-c-h422/1038.png
Alpha Codist
https://alphacodist.blogspot.com/2022/12/snack1038.html
https://alphacodist.blogspot.com/
https://alphacodist.blogspot.com/
https://alphacodist.blogspot.com/2022/12/snack1038.html
true
7547834254111195316
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content