Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  6.  
  7.  
  8. int main(int argc, char *argv[])
  9. {
  10. int i, n, suma=0;
  11. printf("Podaj n liczb ciagu:");
  12. scanf("%d", &n);
  13. float A[n];
  14. for(i=0;i<n;i++)
  15. {
  16. printf("Podaj %d wyraz ciagu monotonicznego: ", i+1);
  17. scanf("%f", &A[i]);
  18. suma=suma+A[i];
  19. printf("Suma wynosi %d \n", suma);
  20. }
  21. printf("%d", sprawdzenie(n, *A));
  22.  
  23. return 0;
  24. }
  25.  
  26.  
  27. int sprawdzenie(int n, float * A) {
  28. int r=1, i;
  29.  
  30. if (n==0 || n==1) {
  31. printf("Ciag nie ma wyrazow lub jest tylko 1, nie moge sprawdzic czy jest rosnacy czy nie \n");
  32. }
  33. else {
  34. if (A[0]<A[1]) {
  35. return 1;
  36. } else {
  37. return 0;
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement