#include<stdio.h>#include<stdlib.h> int cent50=0;int cent20=0;int cent10=0;int cent05=0; void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to exit:");}takechange(&change);if(change>=5&&change<=95){if((change%5)==0){if(change>=5&&change<=95){calculatechange(&change);}}}else{if(change==-1){printf("\nExiting the loop:");break;}else{printf("Please Enter the value between 5 and 95");}}printchange();}printf("\nLoop is terminated");return 0;}brief assessment and analysis of how successful and complicated it was in achieving the requirements like testing cases etc. and a discussion of any problems encountered.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter7: Using Methods
Section: Chapter Questions
Problem 3RQ
icon
Related questions
Question

#include<stdio.h>
#include<stdlib.h>

int cent50=0;
int cent20=0;
int cent10=0;
int cent05=0;

void calculatechange(int* change)
{
if(*change>0)
{
if(*change>=50)
{
*change-=50;
cent50++;
}
else if(*change>=20)
{
*change-=20;
cent20++;
}
else if(*change>=10)
{
*change-=10;
cent10++;
}
else if(*change>=05)
{
*change-=05;
cent05++;
}
calculatechange(change);
}
}
void printchange()
{
if(cent50)
printf("\n50cents:%d coins",cent50);
if(cent20)
printf("\n20cents:%d coins",cent20);
if(cent10)
printf("\n10cents:%d coins",cent10);
if(cent05)
printf("\n05cents:%d coins",cent05);

cent50=0;
cent20=0;
cent10=0;
cent05=0;
}
void takechange(int* change)
{
scanf("%d",change);
getchar();
}
int main()
{
int change=0;
int firstinput=0;
while(1)
{
if(!firstinput)
{
printf("\nEnter the amount:");
firstinput++;
}
else
{
printf("\n\nEnter the amount to continue or Enter -1 to exit:");
}
takechange(&change);
if(change>=5&&change<=95)
{
if((change%5)==0)
{
if(change>=5&&change<=95)
{
calculatechange(&change);
}
}
}
else
{
if(change==-1)
{
printf("\nExiting the loop:");
break;
}
else
{
printf("Please Enter the value between 5 and 95");
}
}
printchange();
}
printf("\nLoop is terminated");
return 0;
}
brief assessment and analysis of how successful and complicated it was in achieving the requirements like testing cases etc. and a discussion of any problems encountered. 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning