Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.74 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(void)
  3. {
  4.     printf("Select the suitable package for you.\n");
  5.     printf("1. 350mb any time data for Rs.29\n");
  6.     printf("2. 350 SMS for Rs.29\n");
  7.     printf("3. Activate both packages for Rs.49 and save Rs.10\n");
  8.     int type, ch = 'Y';
  9.     int sCount = 0, countH = 0, countM = 0, countF = 0;
  10.     while ((sCount <= 100) && (ch == 'Y'|| ch == 'y'))
  11.     {
  12.         printf("\nEnter card type : ");
  13.         scanf(" %d", &type);
  14.         if (type == 1)
  15.             countH++;
  16.         else if (type == 2)
  17.             countM++;
  18.         else if (type == 3)
  19.             countF++;
  20.         else
  21.             printf("Invalid course type");
  22.         sCount++;
  23.         if (sCount >= 10)
  24.         {
  25.             printf("\nYou have reach the maximum number of ragistration for the day");
  26.             break;
  27.         }
  28.         else
  29.         {
  30.             printf("\nDo you want do another registration (Y/N): ");
  31.             scanf("%*c%c", &ch);
  32.         }
  33.     }
  34.     printf("\n----------------------------------------------");
  35.     printf("\n No. of data recharge you have requested : %d\n", countH);
  36.     printf("total ammount : Rs.%.2f\ntotal data: %i mb\n\n",countH * 350, countH * 29.0);
  37.     printf("No. No. of SMS recharge you have requested : %d\n", countM);
  38.     printf("total ammount : Rs.%.2f\ntotal SMS: %i\n\n",countM * 350, countM * 29.0);
  39.     printf("No. of combo recharge you have requested : %d\n", countF);
  40.     printf("total ammount : Rs.%.2f\ntotal SMS: %i\ntotal data: %i mb\n\n",countF*350,countF*350,  countF * 49.0);
  41.     printf("In total\nammount : Rs.%.2f\ntotal SMS: %i\ntotal data: %i mb\n\n",countF*350+countH*350+countM*350,countF*350+countH*350+countM*350,countM*29 + countH*29+countF * 49.0);
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement