List Of Simple C Program - Unit 1
\\ If you have any query or questions on my post, then please comment below //
Write A Program To Caluculate Volume Of A Cuboid:
Formula Of Cuboid Volume: v=l*b*h
Where v = volume, l = length, b = breadth, h = height.
----------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main( )
{
int l,b,h,v;
clrscr();
printf("Enter Length, breadth and height of cuboid");
scanf("%d%d%d",&l,&b,&h);
v=l*b*h;
printf("Volume Of Cuboid is:%d",v);
getch();
}
--------------------------------------------------------------------
Write A Program To Find Sum Of N Natural Numbers In C:
Formula Of Sum Of N Natural Number is:n=n*( n+1)/2
Where n is the number whose natural number we have to find.
----------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main( )
{
int n,sum;
clrscr();
printf("Enter The Number");
scanf("%d",&s);
sum=n*( n+1)/2;
printf("Sum Of N Natural Number is:%d",sum);
getch();
}
--------------------------------------------------------------------
Write A Program To Find Out The Area Of A Triangle By Using Hero's Formula In C:
Hero's Formula is: A =
Where n is the number whose natural number we have to find.
----------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
inta,b,c;
float S,A;
clrscr();
printf("Enter a,b,c & S");
scanf("%d%d%d%f",&a&b,&c,&S);
A=sqrt (s*(s-a)*(s-b)*(s-c)) ;
printf("Area is:%d",A);
getch();
}
--------------------------------------------------------------------
Write A Program To Input 2 Numbers And Perform All Mathematical Operation:
----------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main( )
{
int a,b;
float add, sub, mul, divide;
clrscr();
printf("Enter Two Number");
scanf("%d%d",&a,&b);
add = a+b;
printf ("Addition of two numbers is %f", add);
sub = a-b;
printf ("subtraction of two numbers is %f", sub);
mul = a*b;
printf ("multiplication of two numbers is %f", mul);
divide =a/b;
printf ("Division of two numbers is %f", divide);
getch();
}
--------------------------------------------------------------------
Write A Program To Convert Temperature From Celsius To ferinheight:
----------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main( )
{
float c,f,convert;
clrscr();
printf("Enter Degree Of Celsius & ferinheight ");
scanf("%f%f",&c,&f);
convert=(9*(c/5))+32;
printf ("Ferinheight is %f", convert);
getch();
}
--------------------------------------------------------------------
Write A Program To Multiply Two Float Number & Get Result In Int:
----------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main( )
{
float a,b,mul;
clrscr();
printf("Enter 2 Number To Multiply ");
scanf("%f%f",&a,&b);
mul =a*b;
printf ("Multiplcation is %d", mul);
getch();
}
--------------------------------------------------------------------
Click Here To Know How To Download Above Video Tutorials Or YouTube Videos Free