1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
int main(void) {
struct NOTE {
char name[100];
char family[100];
int tele[15];
};
struct NOTE note[5];
int i;
for(i=0;i<5;i++) {
printf("note %d:\n",i);
printf("name?: "); scanf("%s",¬e[i].name);
printf("family?: "); scanf("%s",¬e[i].family);
printf("telephone?: "); scanf("%d",¬e[i].tele);
}
int z[15];
printf("telephone: ");scanf("%d",z[]);
for(i=0;i<5;i++)
if (strcmp(note[i].tele,z)==0){ //<ТУТ СЦУКА РУГАЕТСЯ,НЕ ПОЙМУ ПОЧЕМУ ХЛП
printf("name: %s\n family %s\n telephone %d\n",note[i].name,note[i].family,note[i].tele);
}
char t[40];
printf("name: "); scanf("%s",t);
for(i=0;i<5;i++)
if (strcmp(note[i].name,t)==0){
printf("name: %s\n family %s\n telephone %d\n",note[i].name,note[i].family,note[i].tele);
}
return 0;
}
Объяснение:
var a, b, с: integer;
begin
write('Введите два числа: ');
readln(a, b);
if a < b then с := a + 1 else с := b + 1;
repeat с := с - 1
until (a mod с = 0) and (b mod с = 0);
write('NOD = ', с)
end.
//2. Алгоритм с вычитанием (цикл while)
var a, b: integer;
begin
write('a = ');
readln(a);
write('b = ');
readln(b);
while a <> b do
if a > b then
a := a - b
else
b := b - a;
writeln('NOD = ', a);
end.