Modify the following code with the comment include #include #include #include #include int main(void) { int arr[2][2] ={{500, 1000}, {750, 325}}; char name, acc_type; int amt; printf("\nEnter your name:") scanf("%c", &name) ; getchar(); printf("\nWould you like you withdraw from (c) Checkings or (s) Savings:") ; scanf("%c", &acc_type) ; printf("\nHow much would you like to withdraw:"); scanf("%d", &amt); if(name == 'a') { switch(acc_type) { case c: printf("\n Amount in account to be withdrawn from: 500"); printf("\nAmount in account after withdrawal:%d",500-amt);break; case s: printf("\n Amount in account to be withdrawn from: 1000);printf("\nAmount in account after withdrawal:%d",1000-amt);break; } } if(name=='b') { switch(acc_type) { case c: printf("\n Amount in account to be withdrawn from: 750"); printf("\nAmount in account after withdrawal:%d",750-amt);break; case s: printf("\n Amount in account to be withdrawn from:325");printf("\nAmount in account after withdrawal:%d",325-amt);break; } } (if(amt >=100) { n100 = amt/100; amt -= n100 * 100; for(int i =0;i=50) { n50 = amt/50; amt -= n50* 50; for(int i =0;i<50;i++) { printf("\n$50 bill"); } } if(amt>=20) { n20 = amt/20; amt -= n20 * 20; for(int i =0;i=10) { n10 = amt/10; amt -= n10 * 10; for(int i =0;i=5) { n5 = amt/5; amt -= n5* 5; for(int i =0;i=1) { n1=amt; for(int i =0;i
Modify the following code with the comment
include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
int main(void) {
int arr[2][2] ={{500, 1000}, {750, 325}};
char name, acc_type;
int amt;
printf("\nEnter your name:")
scanf("%c", &name) ;
getchar();
printf("\nWould you like you withdraw from (c) Checkings or (s) Savings:") ;
scanf("%c", &acc_type) ;
printf("\nHow much would you like to withdraw:");
scanf("%d", &amt);
if(name == 'a')
{
switch(acc_type)
{
case c: printf("\n Amount in account to be withdrawn from: 500");
printf("\nAmount in account after withdrawal:%d",500-amt);break;
case s: printf("\n Amount in account to be withdrawn from: 1000);printf("\nAmount in account after withdrawal:%d",1000-amt);break;
}
}
if(name=='b')
{
switch(acc_type)
{
case c: printf("\n Amount in account to be withdrawn from: 750"); printf("\nAmount in account after withdrawal:%d",750-amt);break;
case s: printf("\n Amount in account to be withdrawn from:325");printf("\nAmount in account after withdrawal:%d",325-amt);break;
}
}
(if(amt >=100)
{
n100 = amt/100;
amt -= n100 * 100;
for(int i =0;i<n100;i++)
{
printf("\n$100 bill");
}}
if(amt>=50)
{
n50 = amt/50;
amt -= n50* 50;
for(int i =0;i<50;i++)
{
printf("\n$50 bill");
}
}
if(amt>=20)
{
n20 = amt/20;
amt -= n20 * 20;
for(int i =0;i<n20;i++)
{
printf("\n$20 bill");
}
}
if(amt >=10)
{
n10 = amt/10;
amt -= n10 * 10;
for(int i =0;i<n10;i++)
{
printf("\n$10 bill");
}
}
if(amt>=5)
{
n5 = amt/5;
amt -= n5* 5;
for(int i =0;i<n5;i++)
{
printf("\n$5 bill");
}
}
if(amt>=1)
{
n1=amt;
for(int i =0;i<n1;i++)
{
printf("\n$1 bill");
}
}
return 0;
}
Step by step
Solved in 4 steps with 3 images