Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main(){
  4. srand(time(0));
  5.  
  6.  
  7. int a, age, age1 , mark ,b ,bin;
  8. char first[10], first1[10], last[10], last1[10], web[30], disk[30];
  9. float answer;
  10. int operator = rand()%-50-1;
  11. char ops[5] = {'+', '-', '*', '/'};
  12. int worked = 1;
  13.  
  14. printf("Welcome to our program");
  15. printf("\n1- High school \n2- University UG \n3- Master or higher");
  16. printf("\nChoose one of the following : ");
  17.  
  18. scanf("%d", &a);
  19. switch(a){
  20. case 1:
  21. printf("You Have to Pass the exam before enter our program");
  22. break;
  23. case 2:
  24. printf("You're Elegible to join our program now !");
  25. break;
  26. case 3:
  27. printf("You're not allowed to join our program , Sorry");
  28. break;
  29. default :
  30. printf("Error ! , Please choose a number from 1 - 3 , Thanks!");
  31. break;
  32. }
  33. if (a == 1)
  34. {
  35. printf("\nPlease Register for the exam :");
  36. printf("\nWhat is Your First Name : ");
  37. scanf("%s", &first1);
  38. printf("\nWhat is Your Last Name : ");
  39. scanf("%s", &last1);
  40. printf("\nWelcome %s %s", first1 , last1);
  41. printf("\nWhat is your age : ");
  42. scanf("%d", &age1);
  43. printf("\n1- Math \n2- Computer");
  44. printf("\nPlease choose one question from these : ");
  45. scanf("%d", &b);
  46. switch(b){
  47. case 1:
  48. printf("\nWelcome! Solve this Equation:\n\n");
  49. printf("%d%c%d=?\n\n", rand()%-50-1, ops[rand()%4], rand()%-50-1);
  50. scanf("%d\n", &answer);
  51. switch (ops[4]) {
  52. case'ops[5]':
  53. answer = operator, ops[rand()%4], operator;
  54. break;
  55. default:
  56. printf("I'm sorry, that is not correct. keep trying.\n");
  57. worked = 0;
  58. }
  59. if (worked ==1) {
  60. printf("Congratulations! You have answered the problem correctly!%d\n", answer);
  61. }
  62. break;
  63. case 2:
  64. printf("\nThe concentric circles on the floppy disk are further divided into : ");
  65. scanf("%s", &disk);
  66. printf("\nGive an example of a binary number : ");
  67. scanf("%s", &bin);
  68. printf("\nA Web site's main page is called : ");
  69. scanf("%s", &web);
  70. break;
  71. default :
  72. printf("Error ! , Please choose a number from 1 - 2 , Thanks!");
  73. break;
  74. }
  75. printf("Thanks We will Contact with you soon !\n");
  76.  
  77. }
  78. else if (a == 2)
  79. {
  80. printf("\nPlease register : ");
  81. printf("\nWhat is Your First Name : ");
  82. scanf("%s", &first);
  83. printf("\nWhat is Your Last Name : ");
  84. scanf("%s", &last);
  85. printf("\nWhat is your age : ");
  86. scanf("%d", &age);
  87. printf("\nWhat is your Marks : ");
  88. scanf("%d", &mark);
  89. printf("\nYou have been Registered Successfully ");
  90. printf("\nWelcome %s %s", first, last);
  91. printf("\nWe will Contact you soon .\n");
  92. }
  93. return 0;
  94.  
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement