Advertisement
elektryk798

odwroc_C

Apr 26th, 2017
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.69 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int i=0,dlugosc;
  7.     char *tablica,tmp;
  8.     printf("podaj dlugosc tablicy: ");
  9.     fscanf_s(stdin,"%c",&dlugosc);
  10.     tablica = (double*) calloc(dlugosc, sizeof(char));
  11.     printf("wczytaj tablice:\n");
  12.     for(i=0;i<dlugosc;i++)
  13.     {
  14.         fflush(stdin);
  15.         fscanf_s(stdin,"%c",&tablica[i]);
  16.     }
  17.     for(i=0;i<dlugosc;i++)
  18.         printf("%c",tablica[i]);
  19.     for(i=0;i<dlugosc/2;i++)
  20.     {
  21.         tmp=tablica[i];
  22.         tablica[i]=tablica[dlugosc-i-1];
  23.         tablica[dlugosc-i-1]=tmp;
  24.     }
  25.     printf("\nzawartosc tablicy:\n");
  26.     for(i=0;i<dlugosc;i++)
  27.         printf("%c",tablica[i]);
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement