5. Write a program that determines the number of digits in a number:
Enter a number: 374
The number 374 has 3 digits
You may assume that the number has no more than 4 digits. HINT: Use if statements to test the number. For example, if the number is between 0 and 9, it has one digit, in between 10 and 99 = 2 digits, etc.
... i havent been able to get anything right for this code except:
/* Program that determines the number of digits in a number */
/* DATE: 07-22-02 */
#include <stdio.h>
int main()
{
int number;
printf("Enter a number: ");
scanf("%d", & number);
... here's where it gets loco
if (0>= number>= 9);
printf("The number %d has 1 digit", number);
.... am i going ab this totally wrong or what?
helppppppppppppp!!!



LinkBack URL
About LinkBacks




ahhh, those were the days......