-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday3.cpp
127 lines (98 loc) · 1.81 KB
/
day3.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include <iostream>
using namespace std;
int main()
{
// cout<<"------Prog1) check char is lowercse ,uppercase & numeric-----\n\n";
char ch;
cin>>ch;
if(ch>='a' && ch<='z')
{
cout<<"This is lowercase"<< endl;
}
else if(ch>='A' && ch<='Z')
{
cout<<"This is uppercase"<< endl;
}
else if(ch>='0' && ch<='9')
{
cout<<"This is numeric"<< endl;
}
/*
cout << "-----Prog2) print 1 to n number using while loop-------\n\n";
int n;
cin >> n;
int i = 0;
while (i < 5)
{
cout << i << " "<< "\n";
i++;
}
*/
/*
cout << "---- Prog3) print 1 to n even number using while loop --------\n\n";
int n, i = 2;
cout << "\nPlease Enter Maximum limit Value to print Even Numbers = ";
cin >> n;
cout << "\nList of Even Numbers from 1 to " <<n << " are\n";
while (i <= n)
{
cout << i << " ";
i = i + 2;
}
*/
/*
cout<< "--- Prog4) sum 1 to n number using while loop------\n";
int n, i = 1, sum = 0;
cout << "Enter number:" << endl;
cin >> n;
cout << endl;
while (i <= n)
{
sum += i;
i++;
}
cout << "Sum N no. is " << sum << endl;
*/
/*
cout<< "---Prog5) sum 1 to n even number------\n";
int n;
int i = 2;
int sum =0;
cin >> n;
cout<<endl;
while (i<=n)
{
if(i%2 == 0)
{
sum = sum + i;
}
i++;
}
cout << "Sum of N even no. is " << sum << endl;
// sum program finsish
*/
cout<< "---- Prog6) check no is prime or not------\n";
int n;
cin>> n;
int i = 2;
while (i<n)
{
if (n%i==0)
{
cout<<"not prime for"<< i <<endl;
}
else{
cout<<"prime for"<< i <<endl;
}
i = i + 1;
}
/*
cout<< "----Prog7) ferenhit to celcius conversion------\n";
float c,f;
cout<<"temperature in farenhit:"<<endl;
cin>>f;
c = 5*(f-32)/9;
cout<<"the value in celcius is"<<c<<"degree"<<endl;
*/
return 1;
}