Advertisement
Istanvir389

13/9/17

Sep 13th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int arr[1000];
  5. int i,n;
  6. printf("Enter number ");
  7.  
  8. scanf("%d",&n);
  9. for(i=0;i<n;i++)
  10. {
  11. scanf("%d",&arr[i]);
  12. }
  13.  
  14. for(i=0;i<n/2;i++)
  15. {
  16. printf("%d ",arr[i]);
  17.  
  18. }
  19. printf("\n");
  20. for(i=n/2;i<n;i++)
  21. {
  22. printf("%d ",arr[i]);
  23. }
  24. return 0;
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. #include<stdio.h>
  33. int main()
  34. {
  35. int arr[1000];
  36. int i,n;
  37. printf("Enter number ");
  38.  
  39. scanf("%d",&n);
  40. for(i=0;i<n;i++)
  41. {
  42. scanf("%d",&arr[i]);
  43. }
  44.  
  45. for(i=0;i<=n/2;i++)
  46. {
  47. printf("%d ",arr[i]);
  48.  
  49. }
  50. printf("\n");
  51. for(i=n/2 +1;i<n;i++)
  52. {
  53. printf("%d ",arr[i]);
  54. }
  55. return 0;
  56. }
  57.  
  58.  
  59.  
  60.  
  61.  
  62. #include<stdio.h>
  63. int main()
  64. {
  65. int arr[1000];
  66. int i,n;
  67. printf("Enter number ");
  68.  
  69. scanf("%d",&n);
  70. for(i=0;i<n;i++)
  71. {
  72. scanf("%d",&arr[i]);
  73. }
  74.  
  75. for(i=0;i<n/3;i++)
  76. {
  77. printf("%d ",arr[i]);
  78.  
  79. }
  80. printf("\n");
  81. for(i=n/3;i<n/3 +3;i++)
  82. {
  83. printf("%d ",arr[i]);
  84. }
  85.  
  86. printf("\n");
  87. for(i=n/3 +3;i<n;i++)
  88. {
  89. printf("%d ",arr[i]);
  90. }
  91. return 0;
  92. }
  93.  
  94.  
  95.  
  96.  
  97.  
  98. #include<stdio.h>
  99. int main()
  100.  
  101. {
  102. int arr[1000];
  103. int avg=0,i,n,sum=0;
  104. printf("Enter number ");
  105. scanf("%d",&n);
  106. for(i=0;i<n;i++)
  107. {
  108. scanf("%d",&arr[i]);
  109.  
  110. }
  111. for(i=0;i<n;i++)
  112. {
  113. //printf("%d",arr[i]);
  114. sum=sum+arr[i];
  115.  
  116. }
  117. printf("%d",sum);
  118. for(i=0;i<n;i++)
  119. {
  120. avg=sum/n;
  121. }
  122. printf("\n Average is %d",avg);
  123.  
  124.  
  125. return 0;
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement