Guest User

Untitled

a guest
Jan 13th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. #define MAX3(a,b,c) a>b?a>c?a:b:b>c?b:c
  2. #define MIN3(a,b,c) a<b?a<c?a:b:b<c?b:c
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <time.h>
  6. #include <stdlib.h>
  7.  
  8. int main (void)
  9. {
  10. int a=0;
  11. int b=0;
  12. int c=0;
  13. int awn=0;
  14. int choice=0;
  15. int lop=0;
  16. int yn=0;
  17. printf("Assn11\nRichardFriesen\n10:00\n\n");
  18. printf("\tWelcome to Assn11\n");
  19. printf("\tWould you like to find the Minimum, choice:1\n\tOr maximum of a number? choice:2\n\n");
  20. printf("\t\tPlease enter 1 or 2.");
  21. do
  22. {
  23. do
  24. {
  25. a,b,c=0;
  26. awn=0;
  27. choice=0;
  28. scanf("%d",&choice);
  29. if (choice==1)
  30. {
  31. printf("Please enter a number for A\n\tA:");
  32. scanf("%d",&a);
  33. printf("Please enter a number for B\n\tB:");
  34. scanf("%d",&b);
  35. printf("Please enter a number for C\n\tC:");
  36. scanf("%d",&c);
  37. awn=MAX3(a,b,c);
  38. printf("Your awnser is %d",awn);
  39. break;
  40. }
  41. else if (choice==2)
  42. {
  43. printf("Please enter a number for A\n\tA:");
  44. scanf("%d",&a);
  45. printf("Please enter a number for B\n\tB:");
  46. scanf("%d",&b);
  47. printf("Please enter a number for C\n\tC:");
  48. scanf("%d",&c);
  49. awn=MIN3(a,b,c);
  50. printf("Your awnser is %d",awn);
  51. break;
  52. }
  53. else
  54. {
  55. printf("Please enter 1 or 2");
  56. }
  57. }
  58. while(choice!=1||choice!=2);
  59.  
  60. lop=1;
  61. switch (lop)
  62. {
  63. case 0:
  64. continue;
  65. case 1:
  66. printf("Would you like to do another?\n\t1y2n:");
  67. scanf("%d",yn);
  68. }
  69. while(
  70.  
  71. system("PAUSE");
  72. return 0;
  73. }
Add Comment
Please, Sign In to add comment