Meera is a food blogger and all her fans craves for the photos of the new restaurants and its dishes . Her manager has asked to tell the exact no of photos she is going to post at the end of weekend. If she posts 3 photos of a dish and there are n dishes at a restaurant.
Can you help her calculate the total photos knowing she will go to 1 restaurant each day?
Input:
7 lines of input has two values representing the name of the place and no of dishes per week.
Output:
Print the Total number of videos by Joslyn at each restaurant
#include <stdio.h> struct video{ char name[20]; int dish; }; int main(){ struct video clip; int total=0,i; for(i=0; i<7; i++){ scanf("%s%d",clip.name,&clip.dish); printf("%s : %d\n",clip.name,3*(clip.dish)); total+=3*clip.dish; } printf("TOTAL : %d",total); return 0; }
INPUT_1:
Shimla 21
Chennai 6
Mysore 4
Kedharnath 23
Amaranth 9
Hydrabad 7
Bangalore 8
OUTPUT:
Shimla: 63
Chennai: 18
Mysore: 12
Kedharnath: 69
Amaranth: 27
Hydrabad: 21
Bangalore: 24
TOTAL: 234
INPUT_2:
delhi 25
Chennai 6
Mumbai 40
Kedharnath 23
Amaranth 19
Hydrabad 17
Bangalore 18
OUTPUT:
delhi: 75
Chennai: 18
Mumbai: 120
Kedharnath: 69
Amaranth: 57
Hydrabad: 51
Bangalore: 54
TOTAL : 444
ILLUSTRATION:
π π π The above code doesn’t give output like this as shown in the above picture. That code gives output as soon as input of one line is given.
As this above picture gives clear output perspective of the code and below π code which gives clear output and an alternate of the above code is here below π π π.
#include <stdio.h> struct video{ char name[20]; int dish; }; int main(){ struct video clip[10]; int i,total=0; for(i=0; i<7; i++){ scanf("%s%d",clip[i].name,&clip[i].dish); total += 3*clip[i].dish; } printf("\n\n"); for(i=0;i<7;i++){ printf("%s : %d\n",clip[i].name,3*(clip[i].dish));} printf("TOTAL : %d\n\n",total); return 0; }
Morae Q!
- Find how long will it take till the next fortune year from the current year.
- Find if it’s possible to distribute all the crayons into boxes and satisfy all the conditions.
- Compute sum of numbers using call by reference.
- Compute the amount of money to be handed over with conditions.
- Find the total number of beautiful triplets in the sequence.
- Find the total amount each worker has to pay individually.
- Find the minimum distance between any pair of equal elements in the array.
- Compute the maximum possible value of the given equation.
- Find the age of the student at the time of joining.
- Compute the total number of photos at each restaurant .
- Find the sum of digits of the number using Union datatype.
- Generate the details of the novels in the expected format.
- Sort the student details based on their names in ascending order.
- Find a way to move the king from current position to different square on chessboard.
- Find the time differences in the two different time zones.
- Identifying the greatest number with a numerator and denominator.
- Find the Minimum number of packages to supply all the bases.
- Tower of Hanoi, A puzzle.
- Compute the sum of array of elements using recursion method.
- Find the super digit of an integer using the rules.