0% found this document useful (0 votes)
52 views20 pages

Name - :-Ankit Kumar Singh Civil Engineering 3 Year. 5 Sem 123180708004

The document contains C code programs to solve the following problems: 1) Find the area of a circle given its diameter. The program takes diameter as input, calculates radius, and uses the formula to find area. 2) Check if a year is leap year or not. It takes year as input and checks if it is divisible by 4. 3) Calculate a+b^2+c^3 by taking a, b, c as input and using formulas. 4) Check if a number is even or odd by taking number as input and checking remainder when divided by 2. 5) Take any character as input and display its ASCII value.

Uploaded by

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

Name - :-Ankit Kumar Singh Civil Engineering 3 Year. 5 Sem 123180708004

The document contains C code programs to solve the following problems: 1) Find the area of a circle given its diameter. The program takes diameter as input, calculates radius, and uses the formula to find area. 2) Check if a year is leap year or not. It takes year as input and checks if it is divisible by 4. 3) Calculate a+b^2+c^3 by taking a, b, c as input and using formulas. 4) Check if a number is even or odd by taking number as input and checking remainder when divided by 2. 5) Take any character as input and display its ASCII value.

Uploaded by

Kishalay Goswami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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