trojanxem

Untitled

Oct 6th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.59 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <string.h>
  4. #include <math.h>
  5. #include <stdlib.h>
  6.  
  7. #define ROZMIAR 5
  8.  
  9. int main()
  10. {
  11.     int a[5];
  12.     double x[ROZMIAR];
  13.     int ile = 0;
  14.     printf("Podaj z ilu elementow ma skladac sie tablica b: \n");
  15.     scanf("%d", &ile);
  16.     int b[ile];
  17.     int i,j,k;
  18.     for(i = 0; i < 5 ; i++)
  19.     {
  20.         printf("Podaj %d element tablicy 'a': \n", i);
  21.         scanf("%d", &a[i]);
  22.     }
  23.     for(j = 0 ; j < ROZMIAR ; j++)
  24.     {
  25.         printf("Podaj %d element tablicy 'x': \n", j);
  26.         scanf("%lf", &x[j]);
  27.     }
  28.     for( k = 0 ; k < ile ; k++)
  29.     {
  30.         printf("Podaj %d element tablicy 'b': \n", k);
  31.         scanf("%d", &b[k]);
  32.  
  33.     }
  34.     for(i = 0; i < 5 ; i++)
  35.     printf("%d element tablicy 'a' to: %d \n", i, a[i]);
  36.     for(j = 0; j < ROZMIAR ; j++)
  37.     printf("%d element tablicy 'x' to: %lf \n", j, x[j]);
  38.     for(k = 0; k < ile ; k++)
  39.     printf("%d element tablicy 'b' to: %d \n", i, b[k]);
  40.     printf("\n\n\n***TABLICA 'A' W ODWROTNEJ KOLEJNOSCI***\n\n");
  41.     for(i = 4 ; i >= 0; i--)
  42.     {
  43.         printf("%d element tablicy 'a' to %d\n", i, a[i]);
  44.     }
  45.  
  46.     int pom = 0, l = 0;
  47.     kcheck:;
  48.     printf("Podaj dolna granice przedzialu z ktorego mam wypisac liczby: \n");
  49.     scanf("%d", &pom);
  50.     printf("Podaj gorna granice: \n");
  51.     scanf("%d", &l);
  52.     if( pom  < 0 || l < 0 || l > ROZMIAR - 1)
  53.     {
  54.         printf("Podales ujemny przedzial! 404! \n ");
  55.         goto kcheck;
  56.     }
  57.     else
  58.     for(j = pom ; j < l ; j++)
  59.     {
  60.         printf("%lf \n" ,x[j]);
  61.     }
  62.     getch();
  63.     return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment