0% found this document useful (0 votes)
2 views1 page

C Programming Language

The document contains C programming examples for various calculations including the area of a rectangle, simple interest, average of three numbers, volume of a cylinder, and converting days into years, months, and days. Each example includes the necessary code snippets and hints for the calculations. The programs utilize standard input and output functions to interact with the user.

Uploaded by

Nathan Prajapati
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)
2 views1 page

C Programming Language

The document contains C programming examples for various calculations including the area of a rectangle, simple interest, average of three numbers, volume of a cylinder, and converting days into years, months, and days. Each example includes the necessary code snippets and hints for the calculations. The programs utilize standard input and output functions to interact with the user.

Uploaded by

Nathan Prajapati
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

C Programming Language

1. WAP to calculate the area of a rectangle in c. [Hints: a = l x b]


#include<stdio.h>
#include<conio.h>
void main()
{
int l, b, a;
printf (“Enter Length: ”);
scanf (“%d”, &l);
printf (“Enter Breadth: “);
scanf (“%d”, &b);
a = l * b;
printf (“The area is %d”, a);
getch();
}
2. WAP to calculate the simple interest in c. [Hints: i= (ptr)/100]
#include<stdio.h>
int main()
{
float p, t, r, i;
printf (“Enter principal time and rate: ”);
scanf (“%f %f %f”, &p, &t, &r);
i= (p*t*r)/100;
printf (“The interest is %f”, i);
return 0;
}
3. WAP to calculate the average of 3 number in c. [Hints: av= (a+b+c)/3]
#include<stdio.h>
int main()
{
float a, b, c, av;
printf (“Enter 3 numbers: ”);
scanf (“%f %f %f”, &a, &b, &rc);
av= (a+b+c)/3;
printf (“The average is %f”, av);
return 0;
}
4. WAP to calculate the volume of cylinder in c. [Hints: v= pi*r*r*h]
#include<stdio.h>
int main()
{
float pi=3.14, r, h, v;
printf (“Enter radius and height: ”);
scanf (“%f %f ”, &r, &h);
v= pi*r*r*h;
printf (“The volume is %f”, v);
return 0;
}
5. WAP to convert days into respective years, months and days.
#include<stdio.h>
int main()
{
int days, y, m,d, rd;
printf (“Enter days”);
scanf (“%d”, &days);
y = days/365;
rd = days%365;
m = rd/30;
d = rd%30;
printf (“Year = %d Month = %d Day = %d", y, m, d);
return 0;
}

You might also like