Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  code
Language: C/C++
Code:
#include <stdio.h>
 
int main()
{
     
     printf("Welcome to Gandu Vendo\n");
     int juice = 150;
     int soda = 100;
     int coffee = 50;
     int item; 
     int change; 
     int bill;
     int finalcost; 
     int quantity; 
     
printf("Please Select Desired item by choosing the appropriate number assigned to the item\n");


printf("1 = Juice pack\n");
printf("2 = Soda\n");
printf("3 = Coffee\n");
scanf("%d",&item); 


if(item = 1)
{  item = juice; 
     printf("You selected Juice Pack\n");
      printf("Juice = PHP %d\n", juice);
}
else if(item = 2)
{ item = soda; 
     printf("You Selected Soda\n");
     printf("Soda = PHP %d\n", soda);
     } 
     
     else if(item = 3)
     { item = coffee; 
          printf("You Selected Coffee\n");
          printf("Coffee = PHP %d\n", coffee);
          }
  else if(item > 3)
  {
       printf("Invalid Selection Please Start again\n");
  scanf("%d",&item); 
  }
  
  printf("Enter Quantity: \n");
  scanf("%d",&quantity);
     printf("Quantity = 3 \n");

finalcost = quantity * item; 

     
printf("Please Enter Your Bill\n");
scanf("%d",&bill);
printf("Bill Received is %d\n", bill);


change = bill - finalcost; 
printf("Your Change is %d\n", change);

}
 
Comments: