Change Calculator Write a program that directs a cashier how to give change. The
ID: 3677073 • Letter: C
Question
Change Calculator Write a program that directs a cashier how to give change. The program has two inputs: The amount due and the amount received from the customer. Display the dollars, quarters, dimes, nickels, and pennies that the customer should receive Print the following combination of stars using a for loop nested inside a for loop. Then a while loop nested inside a for loop. Each letter will have two separate programs that produce the same output. Attach Snipping photo of the source code for all 6 exercises and output.Explanation / Answer
1)
2) A)
#include <stdio.h>
int main()
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("*");
}
printf(" ");
}
return 0;
}
B)
#include <stdio.h>
int main()
{
int i, j, k;
for(i=5;i>=1;i--)
{
for(j=1;j<i;j++)
{
printf(" ");
}
for(k=5;k>=i;k--)
{
printf("*");
}
printf(" ");
}
return 0;
}
C)
#include <stdio.h>
int main()
{
int i, j, k;
for(i=5;i>=1;i--)
{
for(j=5;j>i;j--)
{
printf(" ");
}
for(k=2;k<(i*2);k++)
{
printf("*");
}
printf(" ");
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.