Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define N 15
- int main()
- {
- int tab[N];
- int i;
- srand(time(NULL));
- for(i=0; i<N; ++i){
- tab[i] = rand()%100;
- printf("%d ", tab[i]);
- }
- printf("\n\nLiczby o parzystych indeksach to:\n");
- for(i=0; i<N; ++i){
- if(i%2==0){
- printf("%d ", tab[i]);
- }
- }
- printf("\n\nLiczby o nieparzystych indeksach to:\n");
- for(i=0; i<N; ++i){
- if(i%2==1){
- printf("%d ", tab[i]);
- }
- }
- printf("\n\nElementy tablicy w odwrotnej kolejnosci:\n");
- for(i=N-1; i>=0; --i){
- printf("%d ", tab[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement