Search This Blog

Sunday, 5 July 2015

C++ program to take an amount of money & convert into notes.

#include<stdio.h>
#include<math.h>

int main(){
   int amt,n1,n2,n3,n4,n5,n6,n7,n8,n9,total;
   printf("\n Enter the amount :");
   scanf("%d",&amt);
   n1=amt/1000;
   amt=amt%1000;
   n2=amt/500;
   amt=amt%500;
   n3=amt/100;
   amt=amt%100;
   n4=amt/50;
   amt=amt%50;
   n5=amt/20;
   amt=amt%20;
   n6=amt/10;
   amt=amt%10;
   n7=amt/5;
   amt=amt%5;
   n8=amt/2;
   n9=amt%2;
   total=n1+n2+n3+n4+n5+n6+n7+n8+n9;
   printf(" \n Number of notes of 1000 = %d ",n1);
   printf(" \n Number of notes of 500   = %d ",n2);
   printf(" \n Number of notes of 100   = %d ",n3);
   printf(" \n Number of notes of 50     = %d ",n4);
   printf(" \n Number of notes of 20     = %d ",n5);
   printf(" \n Number of notes of 10     = %d ",n6);
   printf(" \n Number of notes of 5       = %d ",n7);
   printf(" \n Number of notes of 2       = %d ",n8);
   printf(" \n Number of notes of 1       = %d ",n9);
   printf(" \n Total number of currency notes = %d ",total);
 
return 0;
}



labels- money, code, c plus plus, c++, lol, angry, coderus, ovee, mmhasanovee, great, boss, qcoders, coder.



No comments:

Post a Comment