Computer Science, asked by roshinireddyr999, 7 hours ago

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 ashleamoore5
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 MichMich0945
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