-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDSA_3_Loops.cpp
More file actions
42 lines (37 loc) · 766 Bytes
/
Copy pathDSA_3_Loops.cpp
File metadata and controls
42 lines (37 loc) · 766 Bytes
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
#include<iostream>
using namespace std;
int main(){
int i,n;
cin>>n;
i=1;
// int sum=0;
// Print 1 to N
// while(i<=n){
// cout<<i<<endl;
// i=i+1;
// }
// return 0;
// Print the sum from 1 to n
// while(i<=n){
// sum=sum+i;
// i=i+1;
// }
// cout<<"The Sum is "<<sum<<endl;
//Print the sum of even number from 1 to n
// while(i<=n){
// if(i%2==0)
// sum=sum+i;
// cout << i<<endl;
// i=i+1;
// }
// cout<<"The Sum is "<<sum<<endl;
//Prime Number
// i=2;
// while (i<n)
// {
// if(n%i==0)
// cout<<"Not a prime"<<endl;
// else
// cout<<"prime"<<endl;
// i=i+1;
// }