Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "time.h"
- #define K 200
- int MY_FUNC(int *, int *);
- int main ()
- {
- int mass_ch[K], new_ch[K];
- MY_FUNC(mass_ch, new_ch);
- return 0;
- }
- int MY_FUNC(int *mass_ch, int *new_ch)
- {
- int k, kst;
- srand (time(NULL));
- printf ("\tVvedit bajany rozmirnist' masuvy: \n");
- scanf("%d", &kst);
- printf ("\n \t Vash masyv:");
- for (k=0; k<kst; k++)
- {
- mass_ch[k]= rand()%1000+1;
- printf ("\n%d) %d", k+1, mass_ch[k]);
- int poriadok = 1;
- int ch;
- new_ch[k]=0;
- while (mass_ch[k]>0)
- {
- ch = mass_ch[k] % 10;
- if (ch & 1 == 1 && ch!=9)
- ch=ch+1;
- if (ch == 9)
- ch = 0;
- mass_ch[k] /= 10;
- new_ch[k] += ch * poriadok;
- poriadok = poriadok * 10;
- }
- }
- printf ("\n \t Novyi masyv:");
- int j;
- for (j=0; j < kst; j++)
- printf ("\n%d) %d", j+1, new_ch[j]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement