Advertisement
bilasi

Untitled

Apr 21st, 2014
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. /*array reverse*/
  2. #include<stdio.h>
  3. int main()
  4. {
  5. int a[100], i, n;
  6.  
  7. for(i = 0; i<5; i++){
  8. scanf("%d", &a[i]);
  9. }
  10. for(i = 5-1; i>=0; i--){
  11. printf("%d ", a[i]);
  12. }
  13. return 0;
  14.  
  15. }
  16.  
  17. /*summation */
  18. #include<stdio.h>
  19. int main()
  20. {
  21. int a[100], i, n, s = 0;
  22. for(i = 0; i<3; i++){
  23. scanf("%d", &a[i]);
  24. }
  25.  
  26. for(i = 0; i<3; i++){
  27. s = s+a[i];
  28. }
  29. printf("Sum: %d", s);
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement