PROGRAM FOR FINDING AREA
AREA:
#include
#include
#define p 3.14
void main()
{
int r;
float area,circum;
clrscr();
printf("\n enter value of r");
scanf("%d",&r);
area=p*r*r;
circum=2*p*r;
printf("the area is\n");
printf("%f",area);
printf(“the circumference is”);
printf(“%f”,circum);
getch();
}
PROGRAMS FOR FINDING SUM
SUM:
#include
#include
void main()
{
int a,b,sum;
clrscr();
printf("\n enter value of a");
scanf("%d",&a);
printf("enter the value of b");
scanf("%d",&b);
sum=a+b;
printf("the sum is ");
printf("%d",sum);
getch();
}
PROGRAMS FOR FINDING SIMPLE INTEREST
SIMPLE INTEREST:
#include
#include
void main()
{
int p,t;
float r,simple;
clrscr();
printf("enter the value of p");
scanf("%d",&p);
printf("enter the value of r");
scanf("%f",&r);
printf("enter the value of t");
scanf("%d",&t);
simple=p*r*t/100;
printf("simple interest is");
printf("%f",simple);
PROGRAMS FOR INTERCHANGE NUMBERS
INTERCHANGE NUMBERS:
#include
#include
void main()
{
int a,b,c;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
printf("enter the value of b");
scanf("%d",&b);
c=a,a=b,b=c;
printf("the interchanged values are
\n");
printf("a=");
printf("%d",a);
printf("\nb=");
printf("%d",b);
getch();
}
PROGRAM FOR PRINT HELLO
Print HELLO:
#include
#include
void main()
{
clrscr();
printf("HELLO");
getch();
}
PROGRAM FOR REMAINDER OF NO
Remainder of a No:
#include
#include
void main()
{
int a,b,c;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
printf("enter the value of b");
scanf("%d",&b);
c=a%b;
printf("the remainder is\t");
printf("%d",c);
getch();
}
PROG FOR SWAPING NO WITHOUT 3RD NO
Swap numbers without 3rd Variable:
#include
#include
void main()
{
int a,b;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
printf("enter the value of b");
scanf("%d",&b);
a=a+b;
b=a-b;
a=a-b;
printf("the interchanged values are
");
printf("a=");
printf("%d",a);
printf("\nb=");
printf("%d",b);
getch();
}
PROGRAM FOR ADD,SUB,MULT,DIV
Add,Sub,Mul,Div in single statement:
#include
#include
void main()
{
float a,b,c,d,e,f;
clrscr();
printf("enter the value of a");
scanf("%f",&a);
printf("enter the value of b");
scanf("%f",&b);
c=a+b;
d=a*b;
e=a/b;
f=a-b;
printf("the sum is ");
printf("%f",c);
printf("\nthe multiplication
is");
printf("%f",d);
printf("\nthe division is");
printf("%f",e);
printf("\nthe subtraction is");
printf("%f",f);
getch();
}
PROGRAMS FOR USE OF OR
OR:
#include
#include
void main()
{
int a,b,c,d,e;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
printf("enter the value of b");
scanf("%d",&b);
printf("enter the value of c");
scanf("%d",&c);
printf("enter the value of d");
scanf("%d",&d);
e=(a==b)||(c==d);
printf("%d",e);
getch();
}
PROGRAMS FOR USE OF AND
AND:
#include
#include
void main()
{
int a,b,c,d,e;
clrscr();
printf("enter the value of a");
scanf("%d",&a);
printf("enter the value of b");
scanf("%d",&b);
printf("enter the value of c");
scanf("%d",&c);
printf("enter the value of d");
scanf("%d",&d);
e=(a==b)&&(c==d);
printf("%d",e);
getch();
}
No comments:
Post a Comment