- Problem Description
 Bogar (one of the 18 Tamil Siddhars) was one of the great scientist. The Indian council decided that we need to assign some number as a gift to the great scientist.
 There was a suggestion given by the Indian Council. If the sum of cube of each number is again equal to the number then they decided that they can assign the number to the great scientist.
 Kindly help the Indian Council to complete the task by writing a simple logic.
- CODING ARENA
- #include <stdio.h>- #include <math.h>- int main()- {- int num,temp,aux,sum=0;- scanf("%d",&num);- temp=num;- while(num)- {- aux=num%10;- aux=aux*aux*aux;- sum=sum+aux;- num=num/10;- }- if(temp==sum)- printf("Give to Scientist Bogar");- else- printf("Dont Give to Scientist Bogar");- return 0;- }
- Test Case 1
 Input (stdin)- 531 Expected Output- Dont Give to Scientist Bogar 
- Test Case 2
 Input (stdin)- 153 Expected Output- Give to Scientist Bogar 
 
No comments:
Post a Comment