C Program:
#include<stdio.h>
long int factorial(int n)
{
Information about resetting and configuring Mobile phones (Java, Android, Symbian etc), educational articles especially for programming in C, C++ and Java and more about Computers and operating systems
#include<stdio.h>
long int factorial(int n)
{
#include<stdio.h>
void main()
{
int n;
printf("Enter an integer\n");
scanf("%d",&n);
if ( n%2 == 0 )
printf("Even");
else
printf("Odd");
}
#include<iostream.h>
void main()
{
int n;
cout<<"Enter an integer\n";
cin>>n;
if ( n%2 == 0 )
cout<<"\nEven";
else
cout <<"\nOdd";
}
#include <stdio.h>
void main()
{
int year;
printf("Enter a year to check if it is a leap year\n");
scanf("%d", &year);
if(year%400==0 || ((year%4=0) && (year%100!=0)))
printf("%d is a leap year.\n", year); else
printf("%d is not a leap year.\n", year);
}
#include <iostream.h>
void main()
{
int year;
cout<<"Enter a year to check if it is a leap year or not";
cin>>year;
if(year%400==0 || ((year%4=0) && (year%100!=0)))
cout<<"\n"<<year<<"is a leap year."; else
cout<<"\n"<<year<<"is NOT a leap year.";
}
# include <iostream.h>
# include <conio.h>
# include <math.h>
void main ()
{
clrscr();
int a,b=0,sum=0;
long int n;
cout<<"Enter the number to be checked\n ";
cin>>n;
if(n<1)
{
cout<<"\nThe number should be greater than 0";
}
else
{
a=n;
//counting the digits
while (a>0)
{
a=a/10;
b++;
}
a=n;
//adding up bth power of digits
while(a>0)
{
sum=sum+pow(( a%10) ,b);
a=a/10;
}
if(sum==n)
cout<<"\nThe number is an ARMSTRONG number";
else
cout<<"\nThe number is NOT an ARMSTRONG number";
}
getch();
}
# include <stdio.h>
# include <conio.h>
# include <math.h>
void main ()
{
clrscr();
int a,b=0,sum=0;
long int n;
printf("Enter the number to check\n ");
scanf("%i",&n);
if(n<1)
{
printf ("\nThe number should be greater than 0");
}
else
{
a=n;
//counting the digits
while (a>0)
{
a=a/10;
b++;
}
a=n;
//adding up bth power of digits
while(a>0)
{
sum=sum+pow(( a%10) ,b);
a=a/10;
}
if(sum==n)
printf ("\nThe number is an ARMSTRONG number");
else
printf ("\nThe number is NOT an ARMSTRONG number");
}
getch();
}
#include<stdio.h>
#include<string.h>
void main()
{
char a[20];
int i, len;
printf("\nEnter the string:\n");
gets(a);
len = strlen(a);
for (i = 0; i < len / 2; i++)
{
if (a[i] != a[len - i - 1])
break;
}