Skip to content

Commit e26380d

Browse files
committed
Uploading Codes & Notes
1 parent 06cae35 commit e26380d

File tree

216 files changed

+5183
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+5183
-0
lines changed

Codes/01_Hallo.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include<stdio.h>
2+
int main()
3+
{
4+
printf("HALLO Programing World.\n");
5+
return 0;
6+
}

Codes/02_Add.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <stdio.h>
2+
int main()
3+
{
4+
int a, b;
5+
printf("Enter the value of a\n");
6+
scanf("%d", &a);
7+
8+
printf("Enter the value of b\n");
9+
scanf("%d", &b);
10+
11+
printf("The Addition is %d\n", a + b);
12+
13+
return 0;
14+
}

Codes/03_01_Grade1_by_Switch.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include<stdio.h>
2+
int main()
3+
4+
{ int Marks;
5+
printf("Enter your total marks(0-10)\n");
6+
scanf("%d",&Marks);
7+
8+
if (Marks>10 || Marks<0)
9+
{
10+
printf("Don't be smart.Enter the marks between 1 to 10.");
11+
}
12+
else
13+
{
14+
15+
16+
switch(Marks)
17+
{
18+
case 10 :
19+
printf("Your grade is A+. \n" );
20+
break;
21+
case 9 :
22+
printf("Your grade is A. \n" );
23+
break;
24+
case 8 :
25+
printf("Your grade is B. \n" );
26+
break;
27+
default:
28+
printf("Your grade is Fail. \n" );
29+
break;
30+
}
31+
32+
}
33+
return 0;
34+
}

Codes/03_02_Grade2_by_Switch.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include<stdio.h>
2+
int main()
3+
4+
{ int Marks;
5+
printf("Enter your total marks(0-100)\n");
6+
scanf("%d",&Marks);
7+
8+
if ( Marks> 100)
9+
{
10+
printf("Don't be smart.Enter the marks between 1 to 100.");
11+
}
12+
else
13+
{
14+
15+
switch(Marks/10)
16+
{
17+
case 10:
18+
case 9 :
19+
printf("Your grade is A. \n" );
20+
break;
21+
case 8 :
22+
printf("Your grade is B. \n" );
23+
break;
24+
case 7 :
25+
printf("Your grade is C. \n" );
26+
break;
27+
28+
case 6 :
29+
printf("Your grade is D. \n" );
30+
break;
31+
case 5 :
32+
printf("Your grade is E. \n" );
33+
break;
34+
35+
case 4 :
36+
case 3 :
37+
case 2 :
38+
case 1 :
39+
printf("Your grade is Fail. \n" );
40+
break;
41+
42+
default:
43+
printf("Don't be smart.Enter the marks between 1 to 100. \n" );
44+
break;
45+
}
46+
47+
}
48+
49+
return 0;
50+
}

Codes/04_01_LeapYear.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include<stdio.h>
2+
int main()
3+
4+
5+
///////// THIS WRONG LOGIC FOR TO FIND TJE LEAP YEAR//////////
6+
///////// THIS WRONG LOGIC FOR TO FIND TJE LEAP YEAR//////////
7+
///////// THIS WRONG LOGIC FOR TO FIND TJE LEAP YEAR//////////
8+
//FOR REFERENCE SEE THE CODE OF 04_02_LeapYear.c FILE...........................
9+
///////// THIS WRONG LOGIC FOR TO FIND TJE LEAP YEAR//////////
10+
///////// THIS WRONG LOGIC FOR TO FIND TJE LEAP YEAR//////////
11+
12+
13+
{ int Year;
14+
printf("Enter the year that you want to check as leap year or not. \n");
15+
scanf("%d",&Year);
16+
if( Year % 400 == 0 )
17+
{
18+
if( Year % 100 == 0 )
19+
{
20+
if( Year % 4 == 0 )
21+
{
22+
printf("The year you enter is the Leap Year.\n");
23+
}
24+
else
25+
{
26+
printf("The year you enter is not the Leap Year.\n");
27+
28+
}
29+
30+
}
31+
else
32+
{
33+
printf("The year you enter is not the Leap Year");
34+
}
35+
}
36+
else
37+
{
38+
printf("The year you enter is not the Leap Year");
39+
}
40+
41+
return 0;
42+
}
43+

Codes/04_02_LeapYear.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <stdio.h>
2+
3+
//////////////////////// THIS CORRECT CODE FOR TO FIND LEAP YEAR...........
4+
5+
int main()
6+
{
7+
int year;
8+
printf("Enter a year: ");
9+
scanf("%d", &year);
10+
11+
12+
13+
14+
if(year % 400 == 0)
15+
{
16+
printf("%d is a Leap Year.", year);
17+
}
18+
19+
else if (year % 100 == 0)
20+
{
21+
printf("%d is not a LeapYyear.", year);
22+
}
23+
24+
else if (year % 4 == 0)
25+
{
26+
printf("%d is a Leap Year.", year);
27+
}
28+
29+
else
30+
{
31+
printf("%d is not a Leap Year.", year);
32+
}
33+
34+
return 0;
35+
}

Codes/05_01_GratestNo_basic_&_same.c

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#include <stdio.h>
2+
3+
// THIS CODE IS SIMPLE AS IT TAKES ONLY 4 VALUES FROM USER OMLY........................................
4+
5+
6+
/// This for INT DATA TYPE.....////////////
7+
int max(int x, int y)
8+
{
9+
if (x > y)
10+
{
11+
return x;
12+
}
13+
else
14+
{
15+
return y;
16+
}
17+
}
18+
19+
int main()
20+
{
21+
int a,b,c,d;
22+
///////////// int G1 = 0, G2 = 0, G3 = 0;
23+
24+
printf("Enter the firet number \n");
25+
scanf("%d",&a);
26+
27+
printf("Enter the second number \n");
28+
scanf("%d",&b);
29+
30+
printf("Enter the third number\n");
31+
scanf("%d",&c);
32+
33+
printf("Enter the fourth number\n");
34+
scanf("%d",&d);
35+
36+
/////////////////////////////////////////from line 41 to 75 plus line 22 this is wrong way to code to find gratest number.////////////// //comparing first two numbers.......
37+
//////////////////////////////////////// ACTUALLY LOGIC OF THOSE LINES ARE I TRIED FIRST BUT THAT IS FAILED. SO PLEAE NOTE THAT..//////
38+
39+
// if (num_1 > num_2 )
40+
// {
41+
// G1 = num_1;
42+
43+
// }
44+
// else
45+
// {
46+
// G1 = num_2;
47+
// }
48+
49+
// //comparing second two numbers.......
50+
51+
// if (num_3 > num_4)
52+
// {
53+
// G2 = num_3;
54+
// }
55+
// else
56+
// {
57+
// G2 = num_4;
58+
// }
59+
60+
// // comparing number betwwen first and second ......
61+
62+
// if (G1 > G2)
63+
// {
64+
// G3 = G1;
65+
// }
66+
// else
67+
// {
68+
// G3 = G2;
69+
// }
70+
71+
int left_max = max(a,b);
72+
int right_max = max(c,d);
73+
int final_max = max(left_max, right_max);
74+
75+
printf("The gratest number is %d \n", final_max);
76+
77+
return 0;
78+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include <stdio.h>
2+
3+
// THIS CODE IS SIMPLE AS IT TAKES ONLY 4 VALUES FROM USER OMLY........................................
4+
5+
/// This for FLOAT DATA TYPE.....////////////
6+
7+
8+
float max(float x, float y)
9+
{
10+
if(x > y)
11+
{
12+
return x;
13+
}
14+
else
15+
{
16+
return y;
17+
}
18+
}
19+
int main()
20+
{
21+
22+
float a,b,c,d;
23+
24+
printf("Enter the firet number \n");
25+
scanf("%f",&a);
26+
27+
printf("Enter the second number \n");
28+
scanf("%f",&b);
29+
30+
printf("Enter the third number\n");
31+
scanf("%f",&c);
32+
33+
printf("Enter the fourth number\n");
34+
scanf("%f",&d);
35+
36+
float left_max = max(a, b);
37+
float right_max = max(c, d);
38+
float final_max = max(left_max, right_max);
39+
printf("Maximum number is: %f", final_max);
40+
}

Codes/05_03_GratestNo.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include<stdio.h>
2+
3+
// THIS CODE IS GREAT. AS IT TAKES N NUMBER OF VALUES AS THE USER WANT..................7***................................
4+
5+
6+
void main()
7+
{
8+
int maximum(int a[],int n);
9+
int max,i,n;
10+
int a[50];
11+
printf("Enter n number : ");
12+
scanf("%d",&n);
13+
printf("Enter the numbers : \n");
14+
for(i=0;i<n;i++)
15+
scanf("%d",&a[i]);
16+
max=maximum(a,n);
17+
printf("The largest number is %d",max);
18+
}
19+
int maximum(int a[],int n)
20+
{
21+
int i,m=0;
22+
for(i=0;i<n;i++)
23+
{
24+
if(a[i]>m)
25+
m=a[i];
26+
}
27+
return m ;
28+
}

Codes/05_04_GratestNo_&_SmallestNo.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include<stdio.h>
2+
3+
4+
// THIS CODE IS GREAT. AS IT TAKES N NUMBER OF VALUES AS THE USER WANT..................5***................................
5+
6+
7+
int main()
8+
{
9+
int i, n, lar,sm, elem;
10+
printf ("Enter total number of elements n\n ");
11+
scanf ("%d", &elem);
12+
printf ("Enter first number n\n ");
13+
scanf ("%d", &n);
14+
lar = n;
15+
sm=n;
16+
for (i=1; i<= elem -1 ; i++)
17+
{
18+
printf ("n Enter another number n\n ");
19+
scanf ("%d",&n);
20+
if (n>lar)
21+
lar=n;
22+
if (n<sm)
23+
sm=n;
24+
}
25+
printf (" The largest number is %d\n ", lar);
26+
printf (" The smallest number is %d\n ", sm);
27+
return 0;
28+
}

0 commit comments

Comments
 (0)