ПРИКЛАДИ
Приклад1
Приклад 2
167.50K
Категория: ПрограммированиеПрограммирование

Структури повторення. Приклади

1. ПРИКЛАДИ

2. Приклад1

• Вивести значення змінної b за формулою i+j, де і змінюється від 1
до 10, j змінюється від 1 до 5

3.

#include <stdio.h>
#include <conio.h>
int main()
{
int a,b,i,j; b=0;
for (i=0; i < 10; ++i) {
for (j = 0; j < 5; j++) {
b=j+i;
printf("
b=%d",b);
}
printf("\n");
}
getch();
return 0;
}

4.

5.

#include <stdio.h>
#include <conio.h>
int main()
{ int a,b,i,j; b=0;
for (i=0; i < 10; ++i) {
for (j = 0; j < 5; j++) {
b+=j+i;
printf("\t b=%d",b);
}
printf("\n");
}
getch();
return 0;
}

6.

7. Приклад 2

• Обчислити функцію

8.

#include <stdio.h>
#include <conio.h>
#include <math.h>
int main()
{ int n,i,j;
float s,p;
s=0;p=1.0;
printf("\n Input n");
scanf("%d",&n);
for (i=1; i <= n; i++) {p=1.0;
for (j = 1; j <= i; j++) {
p=p*(log(j+2));
}
s=s+(3-(pow(sin(i),2))/p;
}
printf("\n Rezult=%f",s);
getch();
return 0;
}
English     Русский Правила