Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Program 1:(if value is taken by user)

#include<stdio.h>
void main()
{
int a,b,c;
printf("Enter the value of a and b");
scanf("%d%d",&a,&b);
c=a+b;
printf("Addition of two no is %d",c);
}

Program 1:(if value is initialize)


#include<stdio.h>
void main()
{
int a=6,b=9,c;
printf("Enter the value of a and b");
c=a+b;
printf("Addition of two no is %d",c);
}

Program 2:(if value is taken by user)


#include<stdio.h>
void main()
{
int a;
float b,c;
printf("Enter the value of a and b");
scanf("%d%f",&a,&b);
c=a+b;
printf("Addition of two no is %f",c);
}

Program 2:(if value is initialize)


#include<stdio.h>
void main()
{
int a=8;
float b=3.9,c;
printf("Enter the value of a and b");
c=a+b;
printf("Addition of two no is %f",c);
}

Program 3:
#include<stdio.h>
void main()
{
int a=4,b=3,c;
c=a;
a=b;
b=c;
printf("Value of a after swapping is %d",a);
printf("Value of b after swapping is %d",b);
}
Program 4:
#include<stdio.h>
void main()
{
int a=3,b=4;
a=a+b;
b=a-b;
a=a-b;
printf("Value of a after swapping is %d",a);
printf("Value of b after swapping is %d",b);
}

Program 5:
#include<stdio.h>
void main()
{
int f;
float c;
printf("Please Enter temprature in Fahrenheit");
scanf("%d",&f);
c=5/9.0*(f-32);
printf("Temprature in Celsius is %f",c);
}

Program 6:
#include<stdio.h>
void main()
{
int r;
float A,C;
printf(" Please Enter Radius ");
scanf("%d",&r);
A= 3.14*r*r;
C= 2*3.14*r;
printf(" Area of Circle %f",A);
printf(" Circumference of Circle %f",C);
}

Program 7:
#include<stdio.h>
void main()
{
int v;
float V;
printf("Enter Velocity in km/h");
scanf("%d",&v);
V=(5/18.0)*v;
printf("Velocity in m/s is %f",V);
}

Program 8:
#include<stdio.h>
void main()
{
int p,r,t;
float SI;
printf("Enter the value of p,r and t");
scanf("%d%d%d",&p,&r,&t);
SI=(p*r*t)/100.0;
printf("Simple Interest is %f",SI);
}

Program 9:
#include<stdio.h>
void main()
{
int P,R,t;
float CI;
printf("Enter the value of p,r and t");
scanf("%d%d%d",&P,&R,&t);
CI=P*pow(1+R/100.0,t);
printf("Compound Innterest is %f",CI);
}

Program 10:
#include<stdio.h>
void main()
{
int x1,x2,y1,y2;
float m,c;
printf("Enter the value of x1,x2,y1 and y2");
scanf("%d%d%d%d",&x1,&x2,&y1,&y2);
m=(float)(y2-y1)/(x2-x1);
c=y1-m*x1;
printf("Equation of straight line is Y=%fx+%f",m,c);

Program 11:
#include<stdio.h>
void main()
{
char a;
printf("Enter the Character in Upper case");
a=getchar();
printf("Lowercase char is %c",a+32);
}
Program 12:
#include<stdio.h>
void main()
{
char a;
printf("Enter the Character in Lower Case");
a=getchar();
printf("Upper case char is %c",a-32);
}

Program 13:
#include<stdio.h>
void main()
{
char a;
printf("Enter the Character");
a=getchar();
printf("ASCII value is %d",a);
}
Program 14:
#include<stdio.h>
void main()
{
int v,u,a,t;
printf("Enter the Value of u,a and t");
scanf("%d%d%d",&u,&a,&t);
v=u+a*t;
printf("Final Velocity is %d",v);
}

Program 15:
#include<stdio.h>
void main()
{
int BS;
float GS,HRA,DA ;
printf("Enter Your Basic Salary");
scanf("%d",&BS);
HRA=(25*BS/100.0);
DA=(20*BS/100.0);
GS=BS+HRA+DA;
printf("Your Gross Salary is %f",GS);
}

Program 16:
#include<stdio.h>
void main()
{
int b,a,c;
float r1,r2;
printf("Enter the value of b,a,c");
scanf("%d%d%d",&b,&a,&c);
r1=(-b+sqrt(b*b-4*a*c))/2*a;
r2=(-b-sqrt(b*b-4*a*c))/2*a;
printf("Roots of Quardatic Equation is %f
%f",r1,r2);
}

You might also like