Question

Need help with this code, can you do it on c pls. Ask the user for...

Need help with this code, can you do it on c pls.

Ask the user for their first, middle and last initials (3 char variables).

Ask the user how many orders of coffee they want. (single coffee price is 2.99).

Calculate the order total (ignore tax).

Using printf output the users initials and how much they owe.

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

//pls give +va rating,thanks!

#include <stdio.h>

int main(void) {

char first[20],middle[20],last[20];

int number_of_orders;

printf("Enter first name followed by middle name and last name separated by space: ");

scanf("%s%s%s",first,middle,last);

printf("Enter number of coffee orders: ");

scanf("%d",&number_of_orders);

//print the name along with the order total

printf("Customer name : %s %s %s\n",first,middle,last);

printf("Order total: %.2f\n",number_of_orders*2.99);

return 0;

}

==========================================

//output

Enter first name followed by middle name and last name separated by space: Sara J johnson
Enter number of coffee orders: 2
Customer name : Sara J johnson
ORder total: 5.98

Add a comment
Know the answer?
Add Answer to:
Need help with this code, can you do it on c pls. Ask the user for...
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
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