C programs

 -Fibonacci program
This program prints the Fibonacci series

#include<stdio.h>
#include<conio.h>
void main(void)
{
int i,j,k,n;
clrscr();
i=0;
j=1;
printf("%d %d ",i,j);
for(n=0;n<=5;n++)
{
k=i+j;
i=j;
j=k;
printf("%d ",k);
}

getch();
}


-Program to find the given num is Even or odd.



#include<stdio.h>
int main()
{
int n;
printf("\n Enter the number:");
scanf("%d",&n);
if(n>0)
{
n=n%2;
if(n==0)
printf("\n The given number is even");
else
printf("\n The given number is odd");
return 0;
}
}


output:
Enter the number: 222
The given number is even.

civil dept  

ag_10.pdf.rar ag_10.pdf.rar
Size : 37.545 Kb
Type : rar
ag-2m.pdf.rar ag-2m.pdf.rar
Size : 71.939 Kb
Type : rar
MECHANICS OF FLUIDS.pdf.rar MECHANICS OF FLUIDS.pdf.rar
Size : 43.57 Kb
Type : rar
MF-2m.pdf.rar MF-2m.pdf.rar
Size : 78.436 Kb
Type : rar
ms_2010.pdf.rar ms_2010.pdf.rar
Size : 82.539 Kb
Type : rar
ms-2m.pdf.rar ms-2m.pdf.rar
Size : 59.186 Kb
Type : rar
surveying-10.pdf.rar surveying-10.pdf.rar
Size : 40.567 Kb
Type : rar
surveying-2m.pdf.rar surveying-2m.pdf.rar
Size : 79.511 Kb
Type : rar

Aero 

AE- 1PROPULSION-II.pdf.rar AE- 1PROPULSION-II.pdf.rar
Size : 75.991 Kb
Type : rar
Aerodynamics-II.pdf.rar Aerodynamics-II.pdf.rar
Size : 56.502 Kb
Type : rar
aircraft.pdf.rar aircraft.pdf.rar
Size : 427.173 Kb
Type : rar
flight-dynamics.pdf.rar flight-dynamics.pdf.rar
Size : 83.135 Kb
Type : rar
kom.pdf.rar kom.pdf.rar
Size : 236.372 Kb
Type : rar
mt.pdf.rar mt.pdf.rar
Size : 292.832 Kb
Type : rar
commu_EEE.pdf.rar commu_EEE.pdf.rar
Size : 130.027 Kb
Type : rar
te.pdf.rar te.pdf.rar
Size : 298.829 Kb
Type : rar



-Program to find the given num is Prime r not.

#include<stdio.h>
int main()
{

int num, count=0, i;
printf("Enter the Number : ");
scanf("%d", &num);
for(i=1; i<=num; i++)
{
if(num % i == 0)
{
count++;
 }
}
if(count == 2)
{
printf(" The Number is Prime ");
}
else
{
printf(" The Number is Not Prime");
}
return 0;

}



-Program to print the given num in Reverse order.


#include<stdio.h>

main()

{

int n,mod,rev=0;

print("Enter the number:");

scanf("%d",&n);

while(n>0)

{

mod=n%10;

rev=(rev*10)+mod;

n=n/10;

}

printf("The number in reverse order is...%d\n",rev);

}

Output:

   Enter the number:123456

   The number in reverse order is...654321.


- AREA & CIRCUMFERENCE


#include<stdio.h>

int main()
{
float r, area, circum;
printf("Enter the radius of the circle:");
scanf("%f",&r);
area=3.14*r*r;
circum=2*3.14*r;
printf("\nArea=%f",area);
printf("\nCircumstance=%f",circum);
return 0;
}


Output:

Enter the radius of the circle:5
Area=78.500000
Circumstance=31.400000




-CELCIUS ---> FAHRENHEIT

#include<stdio.h>
int main()
{
float cel,faren;
printf("Enter the Celcius value...");
scanf("%f",&cel);
faren=(1.8*cel)+32;
printf("The fahrenheit value of the given value is %f",faren);
return 0;
}

 

Output:

Enter the Celcius value...8
The fahrenheit value of the given value is 46.400002



-LEAP YEAR

#include<stdio.h>
int main()
{ int year;
printf("Enter the year: ");
scanf("%d",&year);
if(year%4==0)
printf("It is a LEAP YEAR ");
else
printf("It is NOT A LEAP YEAR ");
return 0;
}

Output:

Enter the year: 2008
It is a LEAP YEAR

Enter the year: 2010
It is NOT A LEAP YEAR

 -FACTORIAL NUMBER OF GIVEN NUMBER

#include<stdio.h>
int main()
{
int fact=1,i,num;
printf("Enter the number:");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
fact*=i;
}
printf("The factorial of given number is %d",fact);
return 0;
}


Output:

Enter the number:5
The factorial of given number is 120



-PALINDROME OR NOT

#include<stdio.h>
int main()
{
unsigned long int a, num, sum=0, rnum=0, rem;
printf("\nEnter the number");
scanf("%ld",&num);
a=num;
while(num!=0)
{
rem=num%10;
sum=sum+rem;
rnum=(rnum*10)+rem;
num=num/10;
}
printf("\nThe sum of the digits of %ld is %ld\n",a,sum);
printf("\nThe reverse number of the %ld is %ld",a,rnum);
if(a==rnum)
printf("\nThe given number is a palindrome");
else
printf("\nThe given number is not a palindrome");
return 0;
}

Output:







blog comments powered by Disqus

01 - Thuli Thuli - Haricharan, Tanvi.mp3

                                                                                                                                                                         Home       >>

This free website was made using Yola.

No HTML skills required. Build your website in minutes.

Go to www.yola.com and sign up today!

Make a free website with Yola