fork download
  1. /*
  2. فارس محسن فوزي عباس
  3. جروب 3
  4. سكشن 2
  5. */
  6.  
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <ctype.h>
  12.  
  13.  
  14. void week1_1(){
  15. char name[60];
  16. scanf("%s",name);
  17. printf("Hello, %s",name);
  18. }
  19.  
  20. void week1_2(){
  21. int t;
  22. double d;
  23. float f;
  24. char ch;
  25. scanf("%d %lf %f %c", &t, &d, &f, &ch);
  26. printf("%d \n%lf \n%f \n%c", t, d, f, ch);
  27. }
  28.  
  29. void week1_3(){
  30. int x,y;
  31. scanf("%d %d", &x ,&y);
  32. printf("%d + %d = %d" , x ,y , x+y);
  33. printf("\n%d * %d = %d" , x ,y , x*y);
  34. printf("\n%d - %d = %d" , x ,y , x-y);
  35. }
  36.  
  37. void week1_4(){
  38. int a,b,c,d;
  39. scanf("%d %d %d %d",&a ,&b ,&c ,&d);
  40. printf("Difference = %d", ( a * b )-( d * c ));
  41. }
  42.  
  43. void week1_5(){
  44. float r;
  45. scanf("%f",&r);
  46. printf("%f", (r*r) * 3.141592653);
  47. }
  48.  
  49. void week1_6(){
  50. int N,M;
  51. scanf("%d %d", &N, &M);
  52. printf("%d", N%10 + M%10 );
  53. }
  54.  
  55. void week2_1(){
  56. int num;
  57. scanf("%d", &num);
  58.  
  59. for(int loop = 1 ; loop <= num ; loop++)
  60. printf("%d\n",loop);
  61. }
  62.  
  63. void week2_2(){
  64. int num;
  65. scanf("%d", &num);
  66.  
  67. for(int loop = (num < 0 ? num : 1) ; loop <= (num > 0 ? num : -1); loop++){
  68. if(loop%2==0)
  69. printf("%d\n",loop);
  70. }
  71. }
  72.  
  73. void week2_3(){
  74.  
  75. int num_total;
  76.  
  77. int even = 0,odd = 0,postive = 0,negative = 0;
  78. scanf("%d", &num_total);
  79.  
  80. int nums[num_total];
  81.  
  82. for(int i = 0 ; i < num_total ; i++)
  83. scanf("%d",&nums[i]);
  84.  
  85. for(int loop = 0 ; loop < num_total ; loop++){
  86. if(nums[loop] % 2 == 0)
  87. ++even;
  88. else
  89. ++odd;
  90.  
  91. if(nums[loop] > 0)
  92. ++postive;
  93. else if(nums[loop] < 0)
  94. ++negative;
  95. }
  96.  
  97. printf("Even: %d\n",even);
  98. printf("Odd: %d\n",odd);
  99. printf("Postive: %d\n",postive);
  100. printf("Negative: %d\n",negative);
  101. }
  102.  
  103.  
  104. void week2_4(){
  105.  
  106. int nums[5];
  107.  
  108. for(int i = 0 ; i < 5 ; i++)
  109. scanf("%d",&nums[i]);
  110.  
  111. for(int loop = 0 ; loop < 5 ; loop++){
  112. if(nums[loop] == 1999){
  113. printf("Correct\n");
  114. return 0;
  115. }
  116. else
  117. printf("Wrong\n");
  118. }
  119. }
  120.  
  121. void week2_5(){
  122. int num_total;
  123.  
  124. int even = 0,odd = 0,postive = 0,negative = 0;
  125. scanf("%d", &num_total);
  126.  
  127. int nums[num_total];
  128.  
  129. for(int i = 0 ; i < num_total ; i++)
  130. scanf("%d",&nums[i]);
  131.  
  132. int comper1,comper2;
  133.  
  134. for(int start = 0 ; start < num_total ; start++)
  135. if (nums[start] > nums[start-1])
  136. comper1 = nums[start];
  137.  
  138. for(int end = num_total ; end > 0 ; end--)
  139. if (nums[end] > nums[5-end])
  140. comper2 = nums[end];
  141.  
  142. if(comper1>comper2)
  143. printf("%d",comper1);
  144. else
  145. printf("%d",comper2);
  146. }
  147.  
  148. void week2_6(){
  149. int num;
  150. printf("Enter number: ");
  151. scanf("%d", &num);
  152.  
  153. for (int table = 1 ; table <= 12 ; table++)
  154. printf("%d * %d = %d\n",num,table,num*table);
  155. }
  156.  
  157. int main(){
  158.  
  159. //week1_1();
  160. //week1_2();
  161. //week1_3();
  162. //week1_4();
  163. //week1_5();
  164. //week1_6();
  165.  
  166. //week2_1();
  167. //week2_2();
  168. //week2_3();
  169. //week2_4();
  170. //week2_5();
  171. //week2_6();
  172. return 0;
  173. }
  174.  
Success #stdin #stdout 0s 5284KB
stdin
week1 && week2
stdout
Standard output is empty