-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPractical5B-PS2.html
97 lines (94 loc) · 2.23 KB
/
Practical5B-PS2.html
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
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<title>Program</title>
</head>
<body style="background-color:powderblue">
<header>
<h1>Sum Of 10 Numbers</h1>
<style>
h1{
text-align:center;
background-color:grey;
}
</style>
</header>
<section>
<header>
<h2 style="color:red"><em>Code For Given Problem Statement</em></h2>
<h3><strong><u>Problem Statement</u></strong></h3>
<h5>Write a program in any language to read 10 numbers from
keyboard and find their sum and average.</h5>
</header>
<pre>
<code>
using namespace std;
int main()
{
int no,sum=0;
float avg;
cout<< "Enter Numbers:";
for(int i=1;i<=10;i++)
{
cout<< "Number is:" << i;
cin>>no;
sum+=no;
}
avg=sum/10.0;
cout<< "Sum is"<< sum;
cout<< "Average is:"<< avg;
return 0;
}
</code>
</pre>
</section>
<hr>
<div>
<header>
<h4><u>Sample Input</u></h4>
</header>
<p> Input 10 Numbers:<br>
No:1-><kbd>1</kbd><br>
No:2-><kbd>2</kbd><br>
No:3-><kbd>3</kbd><br>
No:4-><kbd>4</kbd><br>
No:5-><kbd>5</kbd><br>
No:6-><kbd>6</kbd><br>
No:7-><kbd>7</kbd><br>
No:8-><kbd>8</kbd><br>
No:9-><kbd>9</kbd><br>
No:10-><kbd>10</kbd><br>
The sum and average of 10 no.s is :<samp>55</samp><br>
<samp>5.500000</samp><br>
</p>
</div>
<hr>
<aside >
<h4><u>Variables used in the program:</u></h4>
<p> int var :<var>no</var>,<var>sum</var>,<var>i</var><br>
float var:<var>avg</var></p>
<h5>Complexity for this program is <strong><i>O(n)<i></strong></h5>
</aside>
<hr>
<section>
<p>
<small>Different Searching Algorithms With their Complexities:</small><br>
1-Linear Search-->O(n)<br>
2-Binary Search-->O(log<sub>2</sub>n)<br>
<small>Sorting Algorithms with their complexities:</small><br>
1-selection sort-->O(n<sup>2</sup>)<br>
2-Merge sort-->O(nlog<sub>2</sub>n)<br>
3- Quick sort--><s>O(n)</s>
</p>
</section>
<hr>
<center>
<footer>
<header>
<h4>Source Code for this program is Available here</h4>
<a href="https://www.w3resource.com/cpp-exercises/for-loop/cpp-for-loop-exercise-2.php"><u>CLICK ME:</u></a>
</header>
</footer>
</center>
</body>
</html>