P050.c (1103B)
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, res = 0, temp, position = 0; 21 printf("Enter the number : "); 22 scanf("%d", &num); 23 temp = num; 24 while (temp > 0) 25 { 26 position++; 27 temp /= 10; 28 } 29 temp = num; 30 while (temp > 0) 31 { 32 res += (int)pow(temp % 10, position); 33 position--; 34 temp /= 10; 35 } 36 if (res == num) 37 printf("\nInput %d is a Disarium Number.", num); 38 else 39 printf("\nInput %d is Not a Disarium Number.", num); 40 return 0; 41 }