Write a Program to count the currency notes.


A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is input through the keyboard, find the total number of currency notes of each denomination the cashier will have to give the withdrawer.

Source Code: 

৬টি মন্তব্য:

  1. #include
    using namespace std;
    int main(){
    int note_100=0,note_50=0,note_10=0;
    int input=0;
    cout<<"Enter Amount : ";
    cin>>input;
    if(input>=100){
    note_100=input/100;
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=50){
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=10){
    note_10=((input%100)%50)/10;
    }
    cout<<"Note of 100 : "<<note_100<<endl;
    cout<<"Note of 50 : "<<note_50<<endl;
    cout<<"Note of 10 : "<<note_10<<endl;
    return 0;
    }

    উত্তরমুছুন
  2. #include
    using namespace std;
    int main(){
    int note_100=0,note_50=0,note_10=0;
    int input=0;
    cout<<"Enter Amount : ";
    cin>>input;
    if(input>=100){
    note_100=input/100;
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=50){
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=10){
    note_10=((input%100)%50)/10;
    }
    cout<<"Note of 100 : "<<note_100<<endl;
    cout<<"Note of 50 : "<<note_50<<endl;
    cout<<"Note of 10 : "<<note_10<<endl;
    return 0;
    }

    উত্তরমুছুন
  3. #include
    using namespace std;
    int main(){
    int note_100=0,note_50=0,note_10=0;
    int input=0;
    cout<<"Enter Amount : ";
    cin>>input;
    if(input>=100){
    note_100=input/100;
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=50){
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=10){
    note_10=((input%100)%50)/10;
    }
    cout<<"Note of 100 : "<<note_100<<endl;
    cout<<"Note of 50 : "<<note_50<<endl;
    cout<<"Note of 10 : "<<note_10<<endl;
    return 0;
    }

    উত্তরমুছুন
  4. #include
    using namespace std;
    int main(){
    int note_100=0,note_50=0,note_10=0;
    int input=0;
    cout<<"Enter Amount : ";
    cin>>input;
    if(input>=100){
    note_100=input/100;
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=50){
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=10){
    note_10=((input%100)%50)/10;
    }
    cout<<"Note of 100 : "<<note_100<<endl;
    cout<<"Note of 50 : "<<note_50<<endl;
    cout<<"Note of 10 : "<<note_10<<endl;
    return 0;
    }

    উত্তরমুছুন
  5. #include
    using namespace std;
    int main(){
    int note_100=0,note_50=0,note_10=0;
    int input=0;
    cout<<"Enter Amount : ";
    cin>>input;
    if(input>=100){
    note_100=input/100;
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=50){
    note_50=(input%100)/50;
    note_10=((input%100)%50)/10;
    }else if(input>=10){
    note_10=((input%100)%50)/10;
    }
    cout<<"Note of 100 : "<<note_100<<endl;
    cout<<"Note of 50 : "<<note_50<<endl;
    cout<<"Note of 10 : "<<note_10<<endl;
    return 0;
    }

    উত্তরমুছুন
  6. #include
    #include
    int main()
    {
    int n,a=10,b=50,c=100,m,back,rem,sum1,sum2,sum3,sum4,sum5;
    printf("The amount which you receive from the users:");
    scanf("%d",&n);
    printf("Enter Your Bill:");
    scanf("%d",&m);
    back=n-m;
    printf("Back:%d",back);
    printf("\n");
    if(back%a==0 || back%b==0 || back%c==0)
    {
    if(back==100)
    {
    int div;
    div=back/c;
    printf("Back: 100 taka notes %d",div);

    }

    else if(back>100)
    {
    int rem=0,div=0;
    div=back/c;
    rem=back%c;
    if(rem==b)
    {
    int c=1;
    printf("Back: 100 taka notes %d ",div);
    printf("+ ");
    printf("50 taka notes %d ",c);

    }
    else if(rem>50 && rem<100)
    {
    sum1=rem/50;
    sum2=rem%50;
    sum3=sum2/10;
    printf("Back: 100 taka notes %d ",div);
    printf("+ ");
    printf("50 taka notes %d",sum1);
    printf("+ ");
    printf("10 taka notes %d ",sum3);

    }
    else if(rem<50)
    {
    sum4=rem/10;
    printf("Back: 100 taka notes %d ",div);
    printf("+ ");
    printf("10 taka notes %d ",sum4);
    }

    }

    else if(back<100)
    {
    int div=0;rem=0;
    div=back/b;
    rem=back%b;
    sum5=rem/a;
    printf("back: 50 Taka notes %d ",&div);
    printf("+ ");
    printf("10 Taka notes %d ",sum5);
    }



    }
    else
    {
    printf("Not enough currency.");
    }
    return 0;
    }

    উত্তরমুছুন