Saturday, 14 January 2012

Program for Leap year Checking


#include
#include
#include
void main()
{
int year;
clrscr();
printf("enter the year=");
scanf("%d",&year);
if(year%4==0)
{
printf("Leap Year");
}
else
{
printf("not a Leap Year");
}
getch();
}
 

Write a Program to check an integer for perfect square


#include
#include
#include
void main()
{
int num,root;
clrscr();
printf("enter the number=");
scanf("%d",&num);
root=sqrt(num);
if(num==root*root)
{
printf("Perfect Square");
}
else
{
printf("not a perfect Square");
}
getch();
}
 

Conversion of Centigrade temperature to fahrenheit


 #include
#include
void main()
{
float fahr,cent;
clrscr();
printf("Enter the temperature in centigrade=");
scanf("%f",¢);
fahr=1.8*cent+32.0;
printf("%f centigrade is equals to the %f fahrenheit",cent,fahr);
getch();
}
 

Write a Program to Convert KiloMeter into Meter,Centimeter,Inch


 #include
#include
void main()
{
long int kilometer,meter,centimeter;
double inch,feet;
printf("Enter the Value in kilometer=");
scanf("%ld",&kilometer);
meter=kilometer*1000;
centimeter=meter*100;
inch=centimeter/2.5;
//feet=
printf("%ld Kilometer is Equals to %ld meter\n",kilometer,meter);
printf("%ld kilometer is Equals to %ld centimeter\n",kilometer,centimeter);
printf("%ld kilometer is Equals to %lf inch",kilometer,inch);
getch();
}