forked from Nastasia8/informatics_42_2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4_Лаба_4(ошибка).cpp
52 lines (48 loc) · 926 Bytes
/
4_Лаба_4(ошибка).cpp
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x,y[0],s,s1,k,n,m,q,w,x1;
cout <<"Введите число: ";
if (cin>>x)
{
s=0;
x1=x;
while (x)
{
x=x/10;
s++;
}
k=0;
n=10;
m=1;
s1=0;
q=0;
w=0;
while (s!=s1)
{
y[k]=x1%n/m;
s1++;
cout <<s1;
n=n*10;
m=m*10;
q=y[k]%2;
if (q==0)
{
w=w+y[k];
}
k=k+1;
}
cout <<endl<<"Сумма чётных чисел = "<<w;
return 0;
}
else
{
goto eror;
}
eror:
cout <<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<<endl<< "Введённые символы некоректны";
return 0;
return 0;
}