Documente Academic
Documente Profesional
Documente Cultură
Answer
# 5
#include<stdio.h>
main()
{
int i,n,count=0;
printf("enter a no.");
scanf("%d",&n);
for(i=2;i<n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count>1)
{
printf("not prime no.");
}
else
printf("prime");
}
void main()
{
int n,b=0,t;
clrscr();
printf( Enter the no );
scanf( %d ,&n);
t=n;
while(n>0)
{
a=n%10;
b=b+a*a*a;
n=n/10;
}
if(b==t)
{
printf( Armstrong no );
}
else
{
printf( Not an armstrong no );
}
getch();
}
#include<stdio.h>
main()
{
unsigned long int n,f;
printf("\nenter the number for which you want to find the factorial");
scanf("%d",&n);
f=fact(n);
printf("\nthe factorial of the number %d is %d",n,f);
}
fact(int n)
{
int k;
if(n==0)
return(1);
else
{
k=n*fact(n-1);
}
return(k);
}
#include
main ()
{
int num,mod,rev=0;
printf("Enter a number:");
scanf("%d", &num);
while (num>0)
{
mod=num%10;
rev=(rev*10)+mod;
num=num/10;
}
printf("Reverse of the given number: %d", rev);
getchar();
}