Tuesday, December 6, 2011

Write a C Program to calculate TT and Recharge Amount

#include <stdio.h>
#include <conio.h>
void main()
{
 int ch;
 float a,d,b,c,e,f;
 clrscr();
 printf("\t\t\tCalculate Talktime and Recharge amount\nBeing 9.3% tax of TRAI for telecom service provider you can calculate Your talktime amd recharge amount");
 printf("\n1. For Conversation Recharge Amount to talk time\n2. For Conversation Talktime to recharge amount");
 printf("\n\nPlease Enter your choice: ");
 scanf("%d",&ch);
 switch(ch)
 {
  case 1:
  {
   printf("\nYou chosing opt. %d and your opt. is conversation Recharge Amt. to TT\nPlease Enter for calculation",ch);
   getch();
   clrscr();
   printf("\nPlease enter your recharge amount:  ");
   scanf("%f",&a);
   printf("\nPlease Enter processing fee: ");
   scanf("%f",&b);
   printf("\nPlease Enter extra charge: ");
   scanf("%f",&c);
   d=a*0.093;
   e=a-d;
   f=e-b-c;
   printf("\nYour Entered amount is: %.f\n\nYour processing fee is %.f\n\nService Tax= %.2f\n\nYour total talk time(deduction of your service tax only)= %.2f\n\nTotal Talk Time(Deduction of all tax)= %.2f Rupees",a,b,d,e,f);
   break;
  }
  case 2:
  {
   printf("\n You chosing opt. %d and your opt. is conversation TT to Rec. Amt.\nPlease Enter for calculation",ch);
   getch();
   clrscr();
   printf("\nEnter your Talktime: ");
   scanf("%f",&a);
   printf("\nPlease enter Procesing fee: ");
   scanf("%f",&b);
   printf("\nPlease enter all taxes: ");
   scanf("%f",&c);
   d=b+c;
   e=a+d;
   f=(e/(1-0.093));
   printf("\nYour Talk Time(included of all taxes): %.2f\n\nFor getting your given Talk Time you must rechage equal or above= %.f Rupees",a,f);
   break;
  }
  default:
  {
   printf("\nInvalid Choice!!");
  }
 }
 getch();
}

No comments:

Post a Comment