-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaverageOfInputNo.txt
More file actions
90 lines (70 loc) · 1.34 KB
/
averageOfInputNo.txt
File metadata and controls
90 lines (70 loc) · 1.34 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
int c;
int d,cont =1;
while (cont == 1)
{
printf("Enter first number\n");
scanf_s("%d",&c);
printf("You entered %d\n", c);
printf("Enter second number\n");
scanf_s("%d",&d);
printf("You entered %d\n", d);
printf("First integer you entered was %d\n", c);
printf("Second integer you entered was %d\n", d);
printf("Sum is %d\n", c+d);
getchar();
if(d == 0)
{
printf("second int is 0, division is impossibru\n");
printf("Multiplication is %d\n", c*d);
}
else
{
printf("Division is %d\n", c/d);
printf("Multiplication is %d\n", c*d);
}
scanf_s("%d",&cont);
}
getchar();
}
int _tmain(int argc, _TCHAR* argv[])
{
int count,sum,a;
a=1;
count=0;
sum=0;
system("pause");
scanf_s("%d",&a);
while (a != 0)
{
sum = sum +a;
count = count +1;
scanf_s("%d",&a);
}
printf("Avarage is %f",(float) sum/count);
system("pause");
return 0;
}
#include "stdafx.h"
#include <Windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
int count,sum,a;
a=1;
count=0;
sum=0;
scanf_s("%d",a);
while (a != 0)
{
printf("Enter %d. number ",count+1);
scanf_s("%d",a);
sum = sum +a;
}
printf("Avarage is %f\n", sum/count);
system("pause");
return 0;
}