Code:
#include<stdio.h>
void p(float);
int main()
{
int month,n;
float rent,t=0,r=0;
scanf("%d\n",&month);
scanf("%f\n",&rent);
scanf("%d\n",&n);
t=rent*n;
r=((rent+(rent*0.2))*n);
switch(month)
{
case 1:
p(t);
break;
case 2:
p(t);
break;
case 3:
p(t);
break;
case 4:
p(r);
break;
case 5:
p(r);
break;
case 6:
p(r);
break;
case 7:
p(t);
break;
case 8:
p(t);
break;
case 9:
p(t);
break;
case 10:
p(t);
break;
case 11:
p(r);
break;
case 12:
p(r);
break;
default: printf("Invalid Input");
break;
}
return 0;
}
void p(float t)
{
printf("Hotel Tariff: Rs.%.2f",t);
}
No comments