Question

C Programming: Who could help me to solve that, couldn't figure it out. Thnx in advance.The shop sell 5 things with...

C Programming:

Who could help me to solve that, couldn't figure it out. Thnx in advance.The shop sell 5 things with the price below:

1.6$

2.8$

3.12$

4.3$

5.9$

Input the order number and count the sum of products. if print -1 stop the execution.Ex: Input 1 2 4 5 -1 Output 26. Need to use switch

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>

int main() {
int total=0, order;
printf("Enter your order :");
scanf("%d",&order);
while(order!=-1){

//using switch case loop

switch (order){
case 1: total = total+6; break;
case 2: total = total+8; break;
case 3: total = total+12; break;
case 4: total = total+3; break;
case 5: total = total+9; break;
default: printf("Invald entry give again"); break;
}
printf("Enter your order :");
scanf("%d",&order);
}
printf("\nSum of Products: %d$", total);
return 0;
}

Output:

Enter your order :1 Enter your order 2 Enter your order :4 Enter your order :5 Enter your order-1 Sum of Products: 26$ Proces

Add a comment
Know the answer?
Add Answer to:
C Programming: Who could help me to solve that, couldn't figure it out. Thnx in advance.The shop sell 5 things with...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java programming Who could help me to solve that, couldn't figure it out. Thanks in advance.The shop sell 5 things w...

    Java programming Who could help me to solve that, couldn't figure it out. Thanks in advance.The shop sell 5 things with the price below: 1.6$ 2.8$ 3.12$ 4.3$ 5.9$ Input the order number and count the sum of products. if print -1 stop the execution.Ex: Input 1 2 4 5 -1 Output 26. Need to use switch

  • These are the questions from my Math packet I can't figure out. Could someone help and...

    These are the questions from my Math packet I can't figure out. Could someone help and explain to me how you got the answer? Thank you! Write an equation to model the situation:   The surface area A of a rectangular prism is the sum of the perimeter P and twice the area of the base B. Tell whether the pairing is a function:                    Input Output -3 4 2 6 -10 8 0 5 Graph the function  with the domain x...

  • Java programming help My program wont run. could someone tell me why. everything seems correct to...

    Java programming help My program wont run. could someone tell me why. everything seems correct to me... giving me the error: Exception in thread "main" java.lang.NumberFormatException: For input string: "Stud" at java.base/java.lang.NumberFormatException.forInputString(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at Util.readFile(Util.java:35) at Driver.main(Driver.java:8) _________________________________________________________________________________________________________________________ Program Prompt: Write a program to perform statistical analysis of scores for a class of students.The class may have up to 40 students.There are five quizzes during the term. Each student is identified by a four-digit...

  • C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require...

    C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require that you read in an encrypted message from a file, decode the message, and then output the message to a file. The encryption method being used on the file is called a shift cipher (Info Here). I will provide you with a sample encrypted message, the offset, and the decrypted message for testing. For this project I will provide you main.cpp, ShiftCipher.h, and ShiftCipher.cpp....

  • I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I...

    I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I just have to explain a lot so you understand how the program should work. In C programming, write a simple program to take a text file as input and encrypt/decrypt it by reading the text bit by bit, and swap the bits if it is specified by the first line of the text file to do so (will explain below, and please let me...

  • Can you please help me with creating this Java Code using the following pseudocode? Make Change C...

    Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.)                                                                                                                                  2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT