Friday, October 26, 2018

Uri 1038 solution in C | Snack

/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/

#include<stdio.h>
main()
{
    int x,y;
    float z;
    scanf("%d%d",&x,&y);
    if(x==1)
    {
        z=y*4;
    }
    else if(x==2)
    {
        z=y*4.5;
    }
      else if(x==3)
    {
        z=y*5;
    }
      else if(x==4)
    {
        z=y*2;
    }
      else if(x==5)
    {
        z=y*1.5;
    }
    printf("Total: R$ %.2f\n",z);
    return 0;
}


 //Happy_Coding

No comments:

Post a Comment