Advertisement
Guest User

questao 3

a guest
Jun 25th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. int main()
  5. {
  6. float resp;
  7. printf ("pense um numero par de 2 ate 18. 0 - nao, 1 - sim\n");
  8. printf ("o numero e maior ou igual a 10?: ");
  9. scanf ("%f", &resp);
  10. if (resp == 0)
  11. {
  12. printf ("\no numero e maior ou igual a 6?: ");
  13. scanf ("%f", &resp);
  14. if (resp == 0)
  15. {
  16. printf ("\no numero e maior ou igual a 4?: ");
  17. scanf ("%f", &resp);
  18. if (resp == 0)
  19. {
  20. printf ("\no numero e 2?: ");
  21. scanf ("%f", &resp);
  22. if (resp == 0)
  23. {
  24. printf ("\no numero e 3.");
  25.  
  26. }
  27. else if (resp = 1)
  28. {
  29. printf ("\n o numero e 2.");
  30.  
  31. }
  32. }
  33. else if (resp == 1)
  34. {
  35. printf ("\no numero e 4?: ");
  36. scanf ("%f", &resp);
  37. if (resp == 0)
  38. {
  39. printf ("\no numero e 5.");
  40.  
  41. }
  42. else if (resp = 1)
  43. {
  44. printf ("\n o numero e 4.");
  45.  
  46. }
  47. }
  48. }
  49. else if (resp == 1)
  50. {
  51. printf ("\no numero e maior ou igual a 8?: ");
  52. scanf ("%f", &resp);
  53. if (resp == 0)
  54. {
  55. printf ("\no numero e 6?: ");
  56. scanf ("%f", &resp);
  57. if (resp == 0)
  58. {
  59. printf ("\no numero e 7.");
  60.  
  61. }
  62. else if (resp == 1)
  63. {
  64. printf ("\no numero e 6.");
  65.  
  66. }
  67. }
  68. else if (resp == 1)
  69. {
  70. printf ("\no numero e 8?");
  71. scanf ("%f", &resp);
  72. if (resp == 0)
  73. {
  74. printf ("\no numero é 9.");
  75.  
  76. }
  77. else if (resp == 1)
  78. {
  79. printf ("\no numero e 8.");
  80.  
  81. }
  82. }
  83. }
  84. }
  85. else if (resp == 1)
  86. {
  87. printf ("\no numero e maior ou igual a 14?: ");
  88. scanf ("%f", &resp);
  89. if (resp == 0)
  90. {
  91. printf ("\no numero e maior ou igual a 12?: ");
  92. scanf ("%f", &resp);
  93. if (resp == 0)
  94. {
  95. printf ("\no numero e 10?: ");
  96. scanf ("%f", &resp);
  97. if (resp == 0)
  98. {
  99. printf ("\no numero e 11.");
  100.  
  101. }
  102. else if (resp == 1)
  103. {
  104. printf ("\no numero e 10.");
  105.  
  106. }
  107. }
  108. else if (resp == 1)
  109. {
  110. printf ("\no numero e 12?: ");
  111. scanf ("%d", &resp);
  112. if (resp == 0)
  113. {
  114. printf ("\no numero e 13.");
  115.  
  116. }
  117. else if (resp == 1)
  118. {
  119. printf ("\no numero e 12.");
  120.  
  121. }
  122. }
  123. }
  124. else if (resp == 1)
  125. {
  126. printf ("\no numero e maior ou igual a 16?: ");
  127. scanf ("%f", &resp);
  128. if (resp == 0)
  129. {
  130. printf ("\no numero e igual a 14?: ");
  131. scanf ("%f", &resp);
  132. if (resp == 0)
  133. {
  134. printf ("\no numero e 15.");
  135.  
  136. }
  137. else if (resp == 1)
  138. {
  139. printf ("\no numero e 14.");
  140.  
  141. }
  142. }
  143. else if (resp == 1)
  144. {
  145. printf ("\no numero e 16?: ");
  146. scanf ("%f", &resp);
  147. if (resp == 0)
  148. {
  149. printf ("\no numero e 17?: ");
  150. scanf ("%f", &resp);
  151. if (resp == 0)
  152. {
  153. printf ("\no numero e 18.");
  154.  
  155. }
  156. else if (resp == 1)
  157. {
  158. printf ("\no numero e 17.");
  159.  
  160. }
  161. }
  162. else if (resp == 1)
  163. {
  164. printf ("\no numero e 16.");
  165.  
  166. }
  167. }
  168. }
  169. }
  170.  
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement