33. FEES CALCULATOR

Image result for c programming
Code:
  #include<stdio.h>
int main()
{
  char s[1];
  int sum=0;
  int rpaper,rfee,arrear,afees;
  scanf("%s",s);
  scanf("%d",&rpaper);
  scanf("%d",&rfee);
  scanf("%d",&arrear);
  scanf("%d",&afees);
  sum=(rpaper*rfee)+(arrear*afees);
  switch(s[0])
  {
    case 'A':printf("The fee to be paid is Rs.%d",sum);
             break;
    case 'B':printf("The fee to be paid is Rs.%d",sum=sum+5000);
            break;
    case 'C':printf("The fee to be paid is Rs.%d",sum=sum+1500);
            break;
    case 'D': printf("The fee to be paid is Rs.%d",sum=sum+6500);
             break;
  }
  return 0;
}

No comments