0% found this document useful (0 votes)
75 views5 pages

Different Types of C Programs'

The document contains several C code programs that demonstrate basic programming concepts like calculating the area and circumference of a circle, finding the greater of two numbers, printing text in a loop, determining if a number is positive or not, calculating the sum of two numbers, finding simple interest, converting temperatures between Celsius and Fahrenheit, calculating the sum and percentage of marks for 5 subjects, swapping two variable values, and adding two matrices. Each program includes the necessary header files and uses basic operations like input, output, conditional statements, and loops to demonstrate how to write simple C programs.

Uploaded by

SonuSingh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views5 pages

Different Types of C Programs'

The document contains several C code programs that demonstrate basic programming concepts like calculating the area and circumference of a circle, finding the greater of two numbers, printing text in a loop, determining if a number is positive or not, calculating the sum of two numbers, finding simple interest, converting temperatures between Celsius and Fahrenheit, calculating the sum and percentage of marks for 5 subjects, swapping two variable values, and adding two matrices. Each program includes the necessary header files and uses basic operations like input, output, conditional statements, and loops to demonstrate how to write simple C programs.

Uploaded by

SonuSingh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 5

WAP TO FIND AREA AND CICUMFERENCE OF CIRCLE

#include<stdio.h>
#include<conio.h>
void main()
{
int r;
float ci,a;
clrscr();
printf("enter the radius of circle");
scanf("%d",&r);
a=3.14*r*r;
ci=2*3.14*r;
printf("circumference of circle is %f\n",ci);
printf("area of circle is %f",a);
getch();
}

WAP TO FIND AREA


#include<stdio.h>
#include<conio.h>
void main()
{
int r;
float a;
clrscr();
printf("enter radius of cirlce");
scanf("%d",&r);
a=3.14*r*r;
printf("area of circle is %f",a);
getch();
}
WAP TO FIND GREATER NO.
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y;
clrscr();
printf("enter thenumber");
scanf("%d%d",&x,&y);
if(x>y)
{
printf("%d is gretare",x);
}
if(x<y)
{
printf("%d is gretare",y);
}
getch();
}
WAP TO PRINT 5 TIMES SONU
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for(i=1;i<=5;i++)
{
printf("sonu\n");
}
getch();
}
WAP TO FIND POSITIVE OR NON POSITIVE NO.
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("enter the number");
scanf("%d",&a);
if(a>0)
{
printf("positive");
}
if(a<0)
{
printf("non positive");
}
getch();
}
WAP TO FIND SUM OF TWO NO.
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,z;
clrscr();
printf("enter the two number");
scanf("%d%d",&x,&y);
printf("sum of %d and %d is %d",x,y,z=x+y);
getch();
}

WAP TO FIND SIMPLE INTEREST


#inlude<stdio.h>
#include<conio.h>
Void main()
{
Int p,r,t;
Float si;
Clrscr();
Printf(“enter the value of principle,rate of interest and time
period”);
Scanf(“%d%d%d”,&p,&r,&t);
Si=(p*r*t*)/100;
Printf(“simple interest is %f”,si);
Getch();
}
WAP TO COVERT TEMPERATURE DEGREE TO FAHRENHEIT
#include<stdio.h>
#include<conio.h>
void main()
{
int c;
float f;
clrscr();
printf("enter temp. in celsious");
scanf("%d",&c);
f=(1.8*c)+32;
printf("temp. in fahrenheit is %f",f);
getch();
}
WAP TO CALCULATE THE SUM AND PERCENTAGE OF 5
SUBJECTS
#include<stdio.h>
#include<conio.h>
void main()
{
int m1,m2,m3,m4,m5,sum;
float a;
clrscr();
printf("enter the marks of 5 subjects");
scanf("%d%d%d%d%d",&m1,&m2,&m3,&m4,&m5);
sum=m1+m2+m3+m4+m5;
a=(sum/5);
printf("sum is %d\n",sum);
printf("percentage is %f",a);
getch();
}

WAP TO SWAP TWO VALUES


#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter values of a and b");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("after swapping the values of and b is %d and %d",a,b);
getch();
}
WAP TO FIND SUM OF TWO MATRIX
#include<stdio.h>
#include<conio.h>
void main()
{
int A[3][3],B[3][3],C[3][3],i,j;
clrscr();
printf("enter 1st matrix of 9 elements");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
scanf("%d",&A[i][j]);
}
}
printf("enter 2nd matrix");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
scanf("%d",&B[i][j]);
}
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
C[i][j]=A[i][j]+B[i][j];
printf("%d ",C[i][j]);
}
printf("\n");
}
getch();
}

You might also like