Header Ads

Header ADS

Solution of URI 1038::Snack

Before seeing the solution make sure that you have tried enough. Don’t copy the whole code, just find out the logic. If you feel any problemyou will inform me by comment.





#include <stdio.h>
int  main()
{
    int X,Y;
    float price;
    scanf("%d%d",&X,&Y);
    if (X==1) {
        price=Y*4.00;
        printf("Total: R$ %.2f\n",price);
    }
     else if (X==2) {
        price=Y*4.50;
        printf("Total: R$ %.2f\n",price);
    }
    else if (X==3) {
        price=Y*5.00;
        printf("Total: R$ %.2f\n",price);
    }
    else if (X==4) {
        price=Y*2.00;
        printf("Total: R$ %.2f\n",price);
    }
    else if (X==5) {
        price=Y*1.50;
        printf("Total: R$ %.2f\n",price);
    }

    return 0;
}

No comments

Theme images by konradlew. Powered by Blogger.