Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

Name -:- Ankit Kumar

Singh
Civil Engineering
rd Th
3 Year. 5 sem
123180708004(04)
Write a program in C to
find out the area of a
circle whose diameter is
given.

#include<stdio.h>
int main()
{
int a;
printf("enter the diameter");
scanf("%d",&a);
float b=a/2;
float area=3.14*b*b;
printf("the area of the circle is
%f",area);
return 0;
}
Write a program in c to
find out whether a year
is leap year or not.

#include<stdio.h>
int main()
{
int a;
printf("enter the year");
scanf("%d",&a);
if(a%4==0)
{
printf("the year is leap year");
}
else
{
printf("wrong choice");
}

}
Write a program in c
that will accept the
values of a,b&c to find
out a+b^2+c^3.

#include<stdio.h>
int main()
{
int a,c,b,d;
printf("enter a,b,c");
scanf("%d%d%d",&a,&b,&c);
d=a+(b*b)+(c*c*c);
printf("the desired output is %d",d);
return 0;
}
Write a program in c to
find out whether the
number is odd/even.

#include<stdio.h>
int main()
{
int a;
printf("enter the number");
scanf("%d",&a);
if(a%2==0)
{
printf("the number is even");
}
else
{
printf("the number is odd");

}
return 0;
}
Write a program in c
that will accept ANY
ChARActer input from
the user and display its
ascii value.

#include<stdio.h>
int main()
{
char c;
printf("enter the character");
scanf("%c",&c);
printf("ASCII is %d",c);
return 0;
}

You might also like