Hello i keep getting this error?? im not user where i went wrong? it just keep added more? thank you

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

//

//  main.c

//  Assignment1

//

//  Created by Hassan omer on 15/10/21.

//

 

#include <stdio.h>

# include <stdlib.h>

int input();

int multiples();

int coins();

void display_change();

int cent50 = 0;

int cent20 = 0;

int cent10 = 0;

int cent05 = 0;

 

int main() {

    char choice = (char)0;

    int num;

    

    do {

    num = input();

    multiples(num);

    coins(num);

    display_change();

       

    

        int cent50 = 0;

        int cent20 = 0;

        int cent10 = 0;

        int cent05 = 0;

    }while(choice != 'q');

    return 0;

}

 

 

int input(int num)

{

    

    printf("enter 5-95 number\n");

    

    scanf("%d",&num);

    return num;

}

 

int multiples(int num)

{

    int sum5 =0;

   

    if (num %5 != 0 ||num<=4|| num >=96) {

        printf("invaild input %d\n",num);

        exit(0);

    }

 

return sum5;

}

 

int coins(int sum5){

    

    if (sum5 > 0)

    {

        while  (sum5 >= 50){

            sum5 -= 50;

            cent50++;

        }

        while  (sum5 >=20){

            sum5 -= 20;

            cent20++;

        }

      while (sum5 >= 10){

            sum5 -=10;

            cent10++;

            

        }

      while (sum5 >= 05){

            sum5 -= 05;

            cent05++;

        }

    }

    return (sum5);

}

 

void display_change(int sum5)

{

    if (cent50)

        printf("cent50 : %d\n",cent50);

    if(cent20)

        printf("cent20 : %d\n",cent20);

    if(cent10)

        printf("cent10 : %d\n",cent10);

    if(cent05)

        printf("cent05 : %d\n",cent05);

}

Hello i keep getting this error?? im not user where i went wrong? it just keep added more? thank you

enter 5-95 number
25
cent20 : 1
cent05 : 1
enter 5-95 number
20
cent20 : 2
cent05 : 1
enter 5-95 number
30
cent20 : 3
cent10 : 1
cent05 : 1
enter 5-95 number
90
cent50 : 1
cent20 : 5
cent10 : 1
cent05 : 1
enter 5-95 number
Transcribed Image Text:enter 5-95 number 25 cent20 : 1 cent05 : 1 enter 5-95 number 20 cent20 : 2 cent05 : 1 enter 5-95 number 30 cent20 : 3 cent10 : 1 cent05 : 1 enter 5-95 number 90 cent50 : 1 cent20 : 5 cent10 : 1 cent05 : 1 enter 5-95 number
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education