Skip to content

Commit 51bbbec

Browse files
Basic_Examples
1 parent 8ff007e commit 51bbbec

13 files changed

+123
-0
lines changed

Addition.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include<stdio.h>
2+
void main()
3+
{ int a,b,c;
4+
printf("Enter two Numbers : ");
5+
scanf("%d %d",&a,&b);
6+
c=a+b;
7+
printf("Sum is %d",c);
8+
}

Area_of_Circle.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include<stdio.h>
2+
void main()
3+
{ float a,r;
4+
printf("Enter the Radius : ");
5+
scanf("%f",&r);
6+
a=3.14*r*r;
7+
printf("Area is %f",a);
8+
}

Area_of_Square.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include<stdio.h>
2+
void main()
3+
{ float a,r;
4+
printf("Enter the Radius : ");
5+
scanf("%f",&s);
6+
a=s*s;
7+
printf("Area is %f",a);
8+
}

Area_of_Triangle.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include<stdio.h>
2+
void main()
3+
{ float a,b,h;
4+
printf("Enter the base : ");
5+
scanf("%f",&b);
6+
printf("Enter the height : ");
7+
scanf("%f",&h);
8+
a=0.5*b*h;
9+
printf("Area is %f",a);
10+
}

Division.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include<stdio.h>
2+
void main()
3+
{ int a,b,c;
4+
printf("Enter two Numbers : ");
5+
scanf("%d %d",&a,&b);
6+
c=a/b;
7+
printf("Division is %d",c);
8+
}

Gross_Salary.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include<stdio.h>
2+
void main()
3+
{ float agp,b,da,gs;
4+
printf("Enter the Basic Salary : \n");
5+
scanf("%f",&b);
6+
printf("Enter the AGP : \n");
7+
scanf("%f",&agp);
8+
printf("Enter the DA in Percentage : \n");
9+
scanf("%f",&da);
10+
gs=(b+agp)*(1+(da/100));
11+
printf("Gross Salary is %f",gs);
12+
}

Separate.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include<stdio.h>
2+
void main()
3+
{ float a,c;
4+
int b;
5+
printf("Enter the Number : ");
6+
scanf("%f",&a);
7+
b=a/1;
8+
c=a-b;
9+
printf("Integer Part is : %d\n",b);
10+
printf("Decimal Part is : %f",c);
11+
}

Simple_Interest.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include<stdio.h>
2+
void main()
3+
{ float p,r,t,s;
4+
printf("Enter the principal : ");
5+
scanf("%f",&p);
6+
printf("Enter the rate : ");
7+
scanf("%f",&r);
8+
printf("Enter the time : ");
9+
scanf("%f",&t);
10+
s=(p*r*t)/100;
11+
printf("SI is %f",s);
12+
}

Subtraction.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include<stdio.h>
2+
void main()
3+
{ int a,b,c;
4+
printf("Enter two Numbers : ");
5+
scanf("%d %d",&a,&b);
6+
c=a-b;
7+
printf("Subtraction is %d",c);
8+
}

Swap_1.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include<stdio.h>
2+
void main()
3+
{ int a,b,t;
4+
printf("Enter two Numbers : ");
5+
scanf("%d %d",&a,&b);
6+
t=b;
7+
b=a;
8+
a=t;
9+
printf("Swap is %d %d",a,b);
10+
}

Swap_2.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include<stdio.h>
2+
void main()
3+
{ int a,b;
4+
printf("Enter two Numbers : ");
5+
scanf("%d %d",&a,&b);
6+
a=a+b;
7+
b=a-b;
8+
a=a-b;
9+
printf("Swap is %d %d",a,b);
10+
}

Temperature.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include<stdio.h>
2+
void main()
3+
{ float a,c,f;
4+
printf("Enter the Temperature in Celcius : ");
5+
scanf("%f",&c);
6+
f=c*(9/5)+32;
7+
printf("Temperature in Fahernheit is %f",f);
8+
}

Trif.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include<stdio.h>
2+
#include<math.h>
3+
void main()
4+
{ double a,b;
5+
printf("Enter the degree : ");
6+
scanf("%lf",&a);
7+
a=(a*3.14)/180;
8+
b=sin(a);
9+
printf("Sine is %lf",b);
10+
}

0 commit comments

Comments
 (0)