Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #define N 12
- #define VERZIO 1
- int main(void){
- int i;
- double tomb[N];
- double *mutato;
- double atlag=0;
- printf("HUF/EUR folyamok:\n");
- srand(time(NULL));
- for (i=0; i<N; i++){
- tomb[i]=rand()%31+280;
- atlag+=tomb[i];
- printf("%2d. ertek: %.1lf\n", i + 1, tomb[i]);
- }
- atlag /= N;
- printf("\nAz atlag: %.3f\n", atlag);
- #if VERZIO == 1
- for(i=0; i<N; i++){
- printf("%d. \t %.1lf \t %6.2lf\n", i+1, tomb[i], tomb[i] - atlag);
- }
- #elif VERZIO == 2
- for (mutato=tomb, i=0; i<N; i++)
- printf("%d. \t %.1lf \t %6.2lf\n", i + 1, *(mutato + i), mutato[i] - atlag);
- #elif VERZIO == 3
- for (mutato=tomb, i=0; mutato <= &tomb[N-1]; i++, mutato++)
- printf("%d. \t %.1lf \t %6.2lf\n", i + 1, *mutato, *mutato - atlag);
- #else
- for (mutato=tomb; mutato <= &tomb[N-1]; mutato++)
- printf("%d. \t %.1lf \t %6.2lf\n", mutato - tomb + 1, *mutato, *mutato - atlag);
- #endif
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment