Advertisement
zaman360live

Final 4031 Zaman

Aug 26th, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. Ans 02.D.
  2. ============
  3. #include<stdio.h>
  4. #include<conio.h>
  5. #include<ctype.h>
  6. #include<stdlib.h>
  7. #include<string.h>
  8. int main()
  9. {
  10. int a,aa, b, zmn[1000];
  11. printf("input how many person?");
  12. scanf("%d",&aa);
  13. int xxx;
  14. char press;
  15. for (int z = 0; z < aa; z++)
  16. {
  17. printf("Person %d\n",z+1);
  18. printf("How many product?\n");
  19. scanf("%d",&a);
  20. for (int i = 0; i < a; i++)
  21. {
  22. scanf("%d",&zmn[i]);
  23. }
  24. printf("Press M for male\nPress F for female\n");
  25. press=toupper(getch());
  26. if (press=='M')
  27. {
  28. xxx = zmn[0];
  29. for (int j = 0; j < a-1; j++)
  30. {
  31. xxx = xxx - zmn[j+1];
  32. }
  33. printf("%d\n",xxx);
  34. }
  35. else if (press=='F')
  36. {
  37. xxx = zmn[0];
  38. for (int k = 0; k < a-1; k++)
  39. {
  40. xxx = xxx + zmn[k+1];
  41. }
  42. printf("%d\n",xxx);
  43. }
  44. else{
  45. printf("Error\n");
  46. }
  47. }
  48.  
  49.  
  50. return 0;
  51. }
  52.  
  53. ==============
  54.  
  55. and 02.a
  56.  
  57. ==============
  58.  
  59. #include <stdio.h>
  60. #include <string.h>
  61. int main()
  62. {
  63. char s[100];
  64.  
  65. gets(s);
  66.  
  67. strrev(s);
  68.  
  69. printf("%s\n", s);
  70.  
  71. return 0;
  72. }
  73.  
  74. ============
  75.  
  76.  
  77.  
  78. ans 02.c
  79. ==========
  80.  
  81. #include<stdio.h>
  82. int main()
  83. {
  84.  
  85. int Day,Hours,Minutes,Second,a,b;
  86.  
  87. printf("Enter your Input:\n");
  88. scanf("%d",&Second);
  89.  
  90. Day=Second/65059;
  91. a= Second % 65059;
  92.  
  93. Hours= a/1513;
  94. b= a % 1513;
  95.  
  96. Minutes = b/89;
  97.  
  98. Second= b%89;
  99.  
  100. printf("Output Will be:\n%d days %d hours %d minutes %d seconds",Day,Hours,Minutes,Second);
  101. }
  102.  
  103.  
  104. ==========
  105.  
  106. ANS 02.B
  107. ===========
  108.  
  109.  
  110. #include <stdio.h>
  111. //UserSnippetBy ZAMAN SHEIKH v0.1
  112. int main()
  113. {
  114. int n;
  115. scanf("%d",&n);
  116. float a[100];
  117. float b[100];
  118. float c;
  119. for (int i = 0; i < n; i++)
  120. {
  121. scanf("%f",&a[i]);
  122. }
  123.  
  124. for (int j = 4; j < n +4; j++)
  125. {
  126. if ( j % 4 == 0)
  127. {
  128. b[j] = a[j-4] + a[j -3];
  129. c =b[j];
  130. }
  131. else if ( j % 4 == 1)
  132. {
  133. b[j] = b[j-1] - a[j -2];
  134. c =b[j];
  135. }
  136. else if ( j % 4 == 2)
  137. {
  138. b[j] = b[j-1] * a[j -2];
  139. c =b[j];
  140. }
  141. else if ( j % 4 == 3)
  142. {
  143. b[j] = b[j-1] / a[j -2];
  144. c =b[j];
  145. }
  146. }
  147.  
  148. if (c == 031) // id 4031
  149. {
  150. printf(" “I am not a liar.\n");
  151. }
  152. else{
  153. printf("Liar Liar!! Big Cheater!");
  154. }
  155.  
  156.  
  157.  
  158.  
  159. printf("\n");
  160. return 0;
  161. }
  162.  
  163.  
  164. ==========
  165.  
  166. ANS 02.e
  167.  
  168. ============
  169.  
  170. Abdullah Al Mamun
  171. #include<stdio.h>
  172. int series(int n)
  173. {
  174. if (n <= 1)
  175. return n;
  176. return series(n-1) + series(n-2) + series(n-3);
  177. }
  178.  
  179. int main ()
  180. {
  181. int n, num;
  182. scanf("%d", &n);
  183. num=n+2;
  184. printf("%d", series(num));
  185. getchar();
  186. return 0;
  187. }
  188. ======
  189.  
  190. 01.a
  191. ======
  192.  
  193. Ans to the Question No.-(1)
  194. ======================
  195.  
  196. #include<stdlib.h>
  197. struct PPS{
  198. int C,S,E;
  199. char dept[12]; //Increase array size
  200. } PPS1={3,2,1};
  201. typedef struct PPS P;
  202.  
  203. int main()
  204. {
  205. struct PPS p={1,2,3,"PPS and CSE"};
  206. struct PPS pp={3,3,3};// pps pp & structure decalar
  207. struct PPS q={1,"skjr",5,6};
  208.  
  209. printf("%d %d %d\n", p.C,p.S,p.E); //use small p
  210.  
  211.  
  212. printf("%d %d %d\n", pp.C,pp.S,pp.E); //use capital C
  213.  
  214. return 0;
  215. }
  216.  
  217.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement