You are on page 1of 5

1.

WAP to calculate and display the area and circumference of a


circle.
#include<stdio.h>
#include<conio.h>

float rad,area,circum;

void main()
{
clrscr();

printf("\n Enter the Radius of Circle: ");


scanf("%f",&rad);

area = 3.14*rad*rad;
circum = 6.18*rad;

printf("\n\n Area of Given Circle: %f",area);


printf("\n Circumference of Given Circle: %f ",circum);

getch();
}

2. WAP to evaluate the following equation : v=u+a*t.


#include<stdio.h>
#include<conio.h>

int v,u,a,t;

void main()
{
clrscr();

printf("\n Enter Initial Velocity (u): ");


scanf("%d",&u);
printf("\n Enter Accelaration (a): ");
scanf("%d",&a);
printf("\n Enter Time Elapsed (t): ");
scanf("%d",&t);

v = u+(a*t);

printf("\n\n Final Velocity of Given Object: %d",v);

getch();
}

3. WAP to take input of name, roll number and marks in 4 subjects


(out of 100) of a student and display average marks obtained.
#include<stdio.h>
#include<conio.h>

int m1,m2,m3,m4,avg,roll;
char name[20]={NULL};

void main()
{
clrscr();

printf("\n Enter Name of Student: ");


scanf("%s",name);
printf("\n Enter Roll Number of Student: ");
scanf("%d",&roll);
printf("\n Enter Marks in 1st Subject: ");
scanf("%d",&m1);
printf("\n Enter Marks in 2nd Subject: ");
scanf("%d",&m2);
printf("\n Enter Marks in 3rd Subject: ");
scanf("%d",&m3);
printf("\n Enter Marks in 4th Subject: ");
scanf("%d",&m4);

clrscr();

avg = (m1+m2+m3+m4)/4;

printf("\n Name: %s",name);


printf("\n Roll Number: %d",roll);
printf("\n Marks in 1st Subject: %d",m1);
printf("\n Marks in 2nd Subject: %d",m2);
printf("\n Marks in 3rd Subject: %d",m3);
printf("\n Marks in 4th Subject: %d",m4);
printf("\n Average Marks Obtained: %d",avg);

getch();
}
4. WAP to get different data type values and display them.
#include<stdio.h>
#include<conio.h>

int a=6;
char b='H';
float c=5.783893;
double d=7.430459;

void main()
{
clrscr();

printf("\n Integer Type: %d",a);


printf("\n Character type: %c",b);
printf("\n Floating Point Type: %f",c);
printf("\n Double Floating Point Type: %lf",d);

getch();
}
5. WAP to display size of datatypes (INT,CHAR,FLOAT,DOUBLE) using
sizeof() function.
#include<stdio.h>
#include<conio.h>

void main()
{
clrscr();

printf("\n Size of Character Data Type: %ld bytes",sizeof(char));


printf("\n Size of Integer Data Type: %ld bytes",sizeof(int));
printf("\n Size of Floating Point Integer: %ld bytes",sizeof(float));
printf("\n Size of Double Floating Point: %ld bytes",sizeof(double));

getch();
}

You might also like