Добавил:
vvrstcnho
Рад, если кому-то помог
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Лабораторные работы С (для ИВТ) / Готовые лабы С / Лаба2 / laba 2 (6)
.c#include <stdio.h>
int main() {
int n, count = 0, temp;
printf("Enter natural number n: ");
scanf("%d", &n);
if (n <= 0) {
printf("Error: n must be natural\n");
return 1;
}
temp = n;
// Используем цикл do...while
do {
count++;
temp /= 10;
} while (temp > 0);
printf("Number of digits in %d: %d\n", n, count);
return 0;
}
Соседние файлы в папке Лаба2
