Program :-
#include <stdio.h>
#include <math.h>
main(){
int temp, num , count = 0,sum = 0,rem;
printf("enter the number : ");
scanf("%d",&num);
temp = num;
while(num > 0){
num = num / 10;
count++ ;
}
for(num = temp ; num > 0 ; num = num /10)
{
rem = num % 10;
sum = sum + pow(r,count);
}
if ( sum == temp)
printf("\n number is strange");
else
printf("\n number is not strange");
}
Output:-
enter the number :
12
number is no strange
#include <stdio.h>
#include <math.h>
main(){
int temp, num , count = 0,sum = 0,rem;
printf("enter the number : ");
scanf("%d",&num);
temp = num;
while(num > 0){
num = num / 10;
count++ ;
}
for(num = temp ; num > 0 ; num = num /10)
{
rem = num % 10;
sum = sum + pow(r,count);
}
if ( sum == temp)
printf("\n number is strange");
else
printf("\n number is not strange");
}
Output:-
enter the number :
12
number is no strange
No comments:
Post a Comment