Write a program to input a number and find whether the number is a Disarium number or not. A number is said to be Disarium if sum of its digits powered with their respective positions is equal to the number itself.
Sample Input: 135
Sample Output: 135 ⇒ 11 + 32 + 53 = 135
So, 135 is a Disarium number.
Answers
Answered by
0
Answer:
Your question is confusing... Still from what I understand..
After taking input, you could just check a no if it is greater that 0 and less than 100, if not make input loop run one more time, if it satisfies, assign it to the array and move on.
Example:
int arr[10];
int temp;
for(int i=0;i<10;i++)
{
cin>>temp;
if(temp>0&&temp<100)
arr[i]=temp;
else
i--;
}
Answered by
0
Program:
Could not add the program here but I've added it in the attachments (:
Note: This is a python program.
Output is provided in the attachments...
Hope this helps you!
Attachments:
Similar questions
English,
4 hours ago
World Languages,
4 hours ago
Geography,
4 hours ago
India Languages,
7 hours ago
Math,
7 hours ago
Chemistry,
8 months ago
Biology,
8 months ago
Math,
8 months ago