P050-SHORT.c (1014B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Write a program to input a number and check whether it is Disarium Number or not. 8 Note : A number is said to Disarium if sum of its digit powered by with their 9 respective position is equal to the original number. */ 10 11 // This code has not been compiled. 12 // If you find any issues, please create a new issue on GitHub regarding them. 13 // Go to this link to create a new issue: https://github.com/notamitgamer/bsc/issues 14 15 #include <stdio.h> 16 #include <math.h> 17 18 int main() 19 { 20 int num; 21 printf("Enter the number : "); 22 scanf("%d", &num); 23 int position = printf("%d", num); 24 int temp = num; 25 int res = 0; 26 while (temp > 0) 27 { 28 res += (int)pow(temp % 10, position); 29 position--; 30 temp /= 10; 31 } 32 if (res == num) 33 printf(" is a Disarium Number."); 34 else 35 printf(" is Not a Disarium Number."); 36 return 0; 37 }