-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestion33..c
More file actions
45 lines (41 loc) · 810 Bytes
/
question33..c
File metadata and controls
45 lines (41 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<stdio.h>
int main()
{
int start,end;
printf("start or end batao:\n");
scanf("%i %i",&start,&end);
if(start<end){
for(int i=start; i<=end; i++){
int sum=0;
int n=i;
int copy=n;
while(n>0){
int digit = n%10;
sum = sum+digit*digit*digit;
n=n/10;
}
if(copy==sum){
printf("%i ",copy);
}
}
}
else{
int temp=start;
start=end;
end=temp;
for(int i=start; i<=end; i++){
int sum=0;
int n=i;
int copy=n;
while(n>0){
int digit = n%10;
sum = sum+digit*digit*digit;
n=n/10;
}
if(copy==sum){
printf("%i ",copy);
}
}
}
return 0;
}