Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  anu1.c
Language: C/C++
Code:
#include <stdio.h>
 main()
{
 char vt;
 float d,n1,m1,b,n2,m2;b=0;
 printf("enter the type of vehiclen");
 scanf("%c",&vt);
 printf("enter the time of going in as hours and minutes in 24hrs formatn");
scanf("%f %f",&n1,&m1);
printf("enter the time of going out as hours and minutes in 24hrs formatn");
scanf("%f %f",&n2,&m2);
if(m2>m1)
d=(n2-n1)+(m2-m1)/60;
else 
d=(n2-1)-n1+(60-(m2-m1))/60;
if(vt=='c')
{
if (d<=3)
b=10;
else
b=20;
}
else if(vt=='b')
{
if(d<=3)
b=5;
else 
b=10;
}
else if(vt=='a')
{
if(d<=3)
b=20;
else
b=30;
}
else
printf("invalid option n");
printf("the bill to be paid is % of",b);
}          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
Comments: