Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX3(a,b,c) a>b?a>c?a:b:b>c?b:c
- #define MIN3(a,b,c) a<b?a<c?a:b:b<c?b:c
- #include <stdio.h>
- #include <string.h>
- #include <time.h>
- #include <stdlib.h>
- int main (void)
- {
- int a=0;
- int b=0;
- int c=0;
- int awn=0;
- int choice=0;
- int lop=0;
- int yn=0;
- printf("Assn11\nRichardFriesen\n10:00\n\n");
- printf("\tWelcome to Assn11\n");
- printf("\tWould you like to find the Minimum, choice:1\n\tOr maximum of a number? choice:2\n\n");
- printf("\t\tPlease enter 1 or 2.");
- do
- {
- do
- {
- a,b,c=0;
- awn=0;
- choice=0;
- scanf("%d",&choice);
- if (choice==1)
- {
- printf("Please enter a number for A\n\tA:");
- scanf("%d",&a);
- printf("Please enter a number for B\n\tB:");
- scanf("%d",&b);
- printf("Please enter a number for C\n\tC:");
- scanf("%d",&c);
- awn=MAX3(a,b,c);
- printf("Your awnser is %d",awn);
- break;
- }
- else if (choice==2)
- {
- printf("Please enter a number for A\n\tA:");
- scanf("%d",&a);
- printf("Please enter a number for B\n\tB:");
- scanf("%d",&b);
- printf("Please enter a number for C\n\tC:");
- scanf("%d",&c);
- awn=MIN3(a,b,c);
- printf("Your awnser is %d",awn);
- break;
- }
- else
- {
- printf("Please enter 1 or 2");
- }
- }
- while(choice!=1||choice!=2);
- lop=1;
- switch (lop)
- {
- case 0:
- continue;
- case 1:
- printf("Would you like to do another?\n\t1y2n:");
- scanf("%d",yn);
- }
- while(
- system("PAUSE");
- return 0;
- }
Add Comment
Please, Sign In to add comment