Advertisement
dsdeep

Test77

Jun 19th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.25 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.   int x,y,age,a=0,b=0,c=0,d=0;
  5.   repeat:
  6.   printf("1. Continue voting\n");
  7.   printf("2. Finish voating\n");
  8.   printf("Enter your choice: ");
  9.   scanf("%d",&x);
  10.   if(x==1)
  11.   {
  12.       printf("\nEnter your age: ");
  13.       scanf("%d",&age);
  14.       if(age>=18)
  15.       {
  16.        printf("\nWhich person you went to vote\n\t1. A\n\t2. B\n\t3. C\n\t4. D\nEnter your choice: ");
  17.        scanf("%d",&y);
  18.        if(y==1)
  19.        {
  20.            a++;
  21.            goto repeat;
  22.        }
  23.           if(y==2)
  24.           {
  25.               b++;
  26.               goto repeat;
  27.           }
  28.           if(y==3)
  29.           {
  30.               c++;
  31.               goto repeat;
  32.           }
  33.            if(y==4)
  34.           {
  35.               d++;
  36.               goto repeat;
  37.           }
  38.       }
  39.       else
  40.         printf("Your are not eligabe for voting\n");
  41.       goto repeat;
  42.   }
  43.   if(x==2)
  44.   {
  45.       printf("Result :\nTotal Votar : %d\n\t1. A : %d vote\n\t2. B : %d vote\n\t3. C : %d vote\n\t3. D : %d vote\n",(a+b+c+d),a,b,c,d);
  46.       if(a>b&&a>c&&a>d)
  47.         printf("A WIN\n");
  48.       else if(b>c&&b>a&&b>d)
  49.         printf("B WIN\n");
  50.       else if(c>a&&c>b&&c>d)
  51.         printf("C WIN\n");
  52.         else if(d>a&&d>b&&d>c)
  53.           printf("D WIN\n");
  54.   }
  55.   return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement