write a program that converts cents to dollars,quarters,dimesand cents. A) use i
ID: 3616531 • Letter: W
Question
write a program that converts cents to dollars,quarters,dimesand cents. A) use interactive approach to ask users to input the totalnumber of cents from the keyboard. B) use symbolic constant to define the conversionfactors:- #define DOLLAR100 #define QUARTER 25 #define DIME 10 C) the output should display something like thefollowing:- 284 cents is equivalent to 2 dollars, 3 quarters, 0 dimes, 9 cents you have to display 2 sets of test data, one set has to be theone used above. for the other set, you choose your own inputvalue write a program that converts cents to dollars,quarters,dimesand cents. A) use interactive approach to ask users to input the totalnumber of cents from the keyboard. B) use symbolic constant to define the conversionfactors:- #define DOLLAR100 #define QUARTER 25 #define DIME 10 C) the output should display something like thefollowing:- 284 cents is equivalent to 2 dollars, 3 quarters, 0 dimes, 9 cents you have to display 2 sets of test data, one set has to be theone used above. for the other set, you choose your own inputvalueExplanation / Answer
#include #include #define DOLLAR 100 #define QUARTER 25 #define DIME 10 void main() { clrscr(); int doller=0,quarter=0,dime=0,cents=0; printf("Enter Cents Please: "); scnaf("%d",¢s); doller=cents/DOLLAR; cents%=DOLLAR; quarter=cents/QUARTER; cents%=QUARTER; dime=cents/DIME; cents%=DIME; printf(" %d cents is equivalents to %d dollars, %d quarters, %ddimes %d cents",doller,quarter,dime,cents); getch(); }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.