write a program to check whether a given integer is a strong
number or not?
[Hint:
145=1!+4!+5!
=1+24+120
=145]
Answer Posted / chandan verma
#include<stdio.h>
#include<conio.h>
void main()
{
int n,tmp,rem,sum=0;
printf("enter a number");
scanf("%d",&n);
tmp=n;
while(n!=0)
{
rem=n%10;
sum+=rem*rem*rem;
n=n/10;
}
if(tmp==sum)
printf("%d is a strong no",tmp);
else
printf("%d is not a strong no",tmp);
getch();
}
printf(
| Is This Answer Correct ? | 20 Yes | 31 No |
Post New Answer View All Answers
What is the easiest sorting method to use?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
Write a code to determine the total number of stops an elevator would take to serve N number of people.
2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier. Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed. When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed. Sequence of take-off is the sequence of addition to the waitlist
Can a local variable be volatile in c?
Difference between linking and loading?
Explain what are binary trees?
Why clrscr is used after variable declaration?
Can you please explain the difference between malloc() and calloc() function?
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
What is the difference between mpi and openmp?
Write a program to show the change in position of a cursor using c
How can I remove the leading spaces from a string?