can u help me with a solution
c programming
Attachments:
Answers
Answered by
1
Answer:
#include <stdio.h>
int fortuneyear(int );
int main(){
int year, r, f = 0, i;
scanf("%d", &year);
for (i = year; f == 0; i++){
f = fortuneyear(i);
}
i--;
printf("%d", i - year);
return 0;
}
int fortuneyear(int x){
int r, c = 0;
while (x){
r = x % 10;
if (r != 0)
c++;
x = x / 10;
}
if (c == 1)
return 1;
else
return 0;
}
Here is the output:
Attachments:
Similar questions