C program to calculate GROSS SALARY of a Person:
#include<stdio.h>
float gross_sal,basic_sal,da,hra;
void main()
{
printf("Enter basic salary of RAMESH\n");
scanf("%f",&basic_sal);
da=(0.4*basic_sal);
hra=(0.2*basic_sal);
gross_sal=(basic_sal+da+hra);
printf("GROSS SALARY OF RAMESH IS %.3f\n",gross_sal);
}
OUTPUT IS SHOWN AT THE LAST
C program for Conversion of KM to CM,M,FEET,INCHES;
#include<stdio.h>
float KM,m,cm,feet,inch;
void main()
{
printf("Enter the distance between two cities\n");
scanf("%f",&KM);
m=(KM*1000);
cm=(m*1000);
feet=(KM*3280.8);
inch=(feet*12.000);
printf("Kilometer in Meters is %.2f\n",m);
printf("Kilometer in Centimeters is %.2f\n",cm);
printf("Kilometer in Feet is %.2f\n",feet);
printf("Kilometer in Inches is %.2f\n",inch);
}
OUTPUT IS SHOWN AT THE LAST
C program to calculate AGGREGATE marks and PERCENTAGE;
#include<stdio.h>
float m1,m2,m3,m4,m5;
float Agg_mar,Perc;
void main()
{
printf("Enter the Marks scored by student in 5 subjects each for 100 marks\n");
scanf("%f%f%f%f%f",&m1,&m2,&m3,&m4,&m5);
Agg_mar=(m1+m2+m3+m4+m5);
Perc=(Agg_mar/500)*100;
printf("Aggregate marks is %.2f\n",Agg_mar);
printf("Total percentage scored is %.2f\n",Perc);
}
C PROGRAM TO CHECK THE TYPE OF TRIANGLE:
#include<stdio.h>
float gross_sal,basic_sal,da,hra;
void main()
{
printf("Enter basic salary of RAMESH\n");
scanf("%f",&basic_sal);
da=(0.4*basic_sal);
hra=(0.2*basic_sal);
gross_sal=(basic_sal+da+hra);
printf("GROSS SALARY OF RAMESH IS %.3f\n",gross_sal);
}
OUTPUT IS SHOWN AT THE LAST
C program for Conversion of KM to CM,M,FEET,INCHES;
#include<stdio.h>
float KM,m,cm,feet,inch;
void main()
{
printf("Enter the distance between two cities\n");
scanf("%f",&KM);
m=(KM*1000);
cm=(m*1000);
feet=(KM*3280.8);
inch=(feet*12.000);
printf("Kilometer in Meters is %.2f\n",m);
printf("Kilometer in Centimeters is %.2f\n",cm);
printf("Kilometer in Feet is %.2f\n",feet);
printf("Kilometer in Inches is %.2f\n",inch);
}
#include<stdio.h>
float m1,m2,m3,m4,m5;
float Agg_mar,Perc;
void main()
{
printf("Enter the Marks scored by student in 5 subjects each for 100 marks\n");
scanf("%f%f%f%f%f",&m1,&m2,&m3,&m4,&m5);
Agg_mar=(m1+m2+m3+m4+m5);
Perc=(Agg_mar/500)*100;
printf("Aggregate marks is %.2f\n",Agg_mar);
printf("Total percentage scored is %.2f\n",Perc);
}
OUTPUT;
C PROGRAM TO CALCULATE AMOUNT OF FINE INDUCED BY A LIBRARY
#include<stdio.h>
int days;
float fine;
void main()
{
printf("Number of days late\n");
scanf("%d",&days);
if(days<=30)
{
if(days<=5)
fine=0.5;
else if(days>=6&&days<=10)
fine=1;
else if(days>10&&days<=30)
fine=5;
printf("The FINE is %.2f\n",fine);
}
else
{
printf("THE MEMBERSHIP IS CANCELLED\n");
}
}
int days;
float fine;
void main()
{
printf("Number of days late\n");
scanf("%d",&days);
if(days<=30)
{
if(days<=5)
fine=0.5;
else if(days>=6&&days<=10)
fine=1;
else if(days>10&&days<=30)
fine=5;
printf("The FINE is %.2f\n",fine);
}
else
{
printf("THE MEMBERSHIP IS CANCELLED\n");
}
}
C PROGRAM TO CHECK THE TYPE OF TRIANGLE:
#include<stdio.h>
#include<stdlib.h>
int a,b,c;
void main()
{
printf("Enter the length of the sides of a Triangle\n");
scanf("%d%d%d",&a,&b,&c);
if((a<=0)||(b<=0)||(c<=0))
{
printf("This is not a triangle\n");
}
else if(a==b&&b==c)
{
printf("The Triangle is Equilateral");
exit(0);
}
else if((a==b)||(a==c)||(b==c))
{
printf("The Triangle is Isosceles");
}
else if(((a*a)+(b*b)==(c*c))||((b*b)+(c*c)==(a*a))||((c*c)+(b*b)==(a*a)))
{
printf("The Triangle is Right-Angled");
}
else
{
printf("The Triangle is Scalene");
}
}
#include<stdlib.h>
int a,b,c;
void main()
{
printf("Enter the length of the sides of a Triangle\n");
scanf("%d%d%d",&a,&b,&c);
if((a<=0)||(b<=0)||(c<=0))
{
printf("This is not a triangle\n");
}
else if(a==b&&b==c)
{
printf("The Triangle is Equilateral");
exit(0);
}
else if((a==b)||(a==c)||(b==c))
{
printf("The Triangle is Isosceles");
}
else if(((a*a)+(b*b)==(c*c))||((b*b)+(c*c)==(a*a))||((c*c)+(b*b)==(a*a)))
{
printf("The Triangle is Right-Angled");
}
else
{
printf("The Triangle is Scalene");
}
}
No comments:
Post a Comment