Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

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;
}

 

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education