You are on page 1of 1

/******************************************************************************

Welcome to GDB Online.


GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP,
Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS,
JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>

int main()
{
char food;
int plates,distance,cost=0;

printf("enetr the food type- ( V ) OR ( N )\n");


scanf("%c",&food);
if(food!='V'&&food!='N')
cost=-1;
else
{
printf("enter the number of plates\n");
scanf("%d",&plates);
if(plates<1)
cost=-1;
else
{

printf("enetr delivery distance\n");


scanf("%d",&distance);

if(food=='V')
cost=120;
else if(food=='N')
cost=150;

if(plates>1)
cost=cost*plates;

if(distance>3 && distance<=6)


cost=cost+((distance-3)*3);
else if(distance>6)
cost=cost+9+((distance-6)*6);
}
}
printf("final bill= %d",cost);

return 0;
}

You might also like