• нужно перевести на си
    program prog;
    uses     crt;
    const      n = 10;
    var    a: array[1..n] of integer;    
    i: integer;    
    count: integer; b
    egin      clrscr;      
    randomize;      
    count := 0;      
    for i := 1 to n do      begin           a[i] := random(n) + 1;          
    write(a[i], ' ');          
    if ((not odd(i)) and odd(a[i])) then              inc(count);      
    end;      
    writeln;      
    writeln('Count: ', count);      
    readkey; end.

Ответы 1

  • #include <stdio.h>#include <stdlib.h>main(){    #define N 10    int i,count=0;    int a[N];    srand(time(0));    for (i=0; i<N; i++) {        a[i]=rand()%(i+1)+1;        printf("%d ",a[i]);        if ((i%2==0) && (a[i]%2!=0)) count++;    }    printf("Count=%d",count);    system("pause");}
    • Автор:

      guapo9j4h
    • 6 лет назад
    • 0
  • Добавить свой ответ

Еще вопросы

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years