Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(int argc, char *argv[])
  5. { int y[100], p, L, N, pocet;
  6.  
  7. printf("vloz pocet cisel:");
  8. scanf("%i", &N);
  9.  
  10. if (N>100) { printf("Prilis mnoho cisel. Restartuj program. \n\n"); system("PAUSE"); return -2; }
  11.  
  12. for (L=0; L<N; L=L+1) {
  13. printf("vloz cislo s poradovym indexem %i:", L+1);
  14. scanf("%i", &y[L]);
  15. }
  16.  
  17. pocet = 0;
  18. for (L=0; L<N; L=L+1) {
  19. if (y[L] < 0)
  20. pocet = pocet + 1;
  21. }
  22.  
  23. printf("\n\nvypis v opacnem poradi:\n\n");
  24. for (p=N-1; p>=0; p=p-1) {
  25. printf("pac. c. %i vyska %i cm\n", p+1, y[p]);
  26.  
  27. }
  28. // printf("\nMezi vlozenymi cisly je %i zapornych.\n\n", pocet);
  29.  
  30. system("PAUSE");
  31. return 0;
  32.  
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. /*
  74. int poc, L,K, N, M;
  75. int y[100][100];
  76.  
  77. //N=4;
  78. //y[0]=111; y[1]=222; y[2]=333; y[3]=444;
  79. scanf("%i", &N);
  80. scanf("%i", &M);
  81.  
  82. for(L=0; L<N; L=L+1)
  83. for(K=0; K<M; K=K+1)
  84. {
  85. printf("vlozte prvek na radku %i a sloupci %i :",L, K );
  86. scanf("%i", &y[L][K]);
  87. }
  88.  
  89. for(L=0; L<N; L=L+1)
  90. {
  91. for(K=0; K<M; K=K+1)
  92. {
  93. printf("%i ", y[L][K]);
  94. }
  95.  
  96. printf("\n");
  97. }
  98.  
  99. printf("\n");
  100. for(L=0; L<N; L=L+1)
  101. {
  102. printf("prvek s indexem %i je %i\n", L, y[L]);
  103. }
  104.  
  105. poc=0;
  106.  
  107. for(L=0; L<N; L++)
  108. if(y[L]<0) poc++;
  109.  
  110. printf("pocet zapornych je %i \n\n", poc);
  111.  
  112.  
  113.  
  114.  
  115. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement