Search
 
SCRIPT & CODE EXAMPLE
 

C

denomination counter

#include <stdio.h>
#define SIZE 6

int main() 
{    
    int amount, notes;   

    // currency denominations
    int denominations[SIZE] = {500, 100, 50, 20, 10, 1};

    printf("Enter amount: ");
    scanf("%d", &amount);

    printf("
");

    for (int i = 0; i < SIZE; i++) 
    {
        notes = amount / denominations[i];

        if (notes)
        {
            amount = amount % denominations[i]; // remaining money

            printf("%d * %d = %d 
", notes, denominations[i], 
                notes * denominations[i]);
        }                
    }

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: send array through a pipe 
C :: write a c program to find out ncr factor of given number 
C :: if statement shortcut c 
C :: c type conversion 
C :: Array in element from lowest 
C :: adding three numbers in c 
C :: shortest job first 
C :: c language dictionary implemet 
C :: Print the number 0 using write() 
C :: c check if character is a punctuation 
C :: passage on dowry 
C :: read a string 
C :: C fgets() and puts() 
C :: q2. wap in c to input 5 numbers in an array and display in reverse order. 
C :: can we use special characters in switch case in c 
C :: C++ initalize int16_t value 
C :: Typecast Operator in C language 
C :: concate string in c 
C :: jframe mittig positionieren 
Dart :: flutter wait for specific time 
Dart :: materialstateproperty color 
Dart :: reverse srring in dart 
Dart :: loop in dart 
Dart :: flutter auto height container 
Dart :: how to get screen size in flutter 
Dart :: cross icon flutter 
Dart :: How do I rotate widget in flutter? 
Dart :: flutter display widget based on device orientation 
Dart :: flutter full screen bottom sheet 
Dart :: dart reverse list 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =