David loved numbers. he would like to segregate numbers based on below confirmations.
A number is a positive number which has zeroes present in it.
A number with only leading os will not be considered.
If above two conditions satisfied, he will call it as "valid number" otherwise "invalid number".
Write a program in c to help David to identify number according to above categories.
Answers
Answered by
0
Answer:
so many things and expressions are not filtered are the most popular galleries are not able leadership
Answered by
0
Answer:
#include <stdio.h>
int main() {
int num, temp, remainder, valid = 0;
printf("Enter a positive number: ");
scanf("%d", &num);
temp = num;
while(temp != 0) {
remainder = temp % 10;
if (remainder == 0) {
valid = 1;
break;
}
temp /= 10;
}
if (valid == 1 && num % 10 != 0) {
printf("%d is a valid number.\n", num);
} else {
printf("%d is an invalid number.\n", num);
}
return 0;
}
To learn more about C Programming from the given link:
https://brainly.in/question/294885
#SPJ2
Similar questions