
Вопрос задан 30.04.2019 в 18:21.
Предмет Информатика.
Спрашивает Буланчиков Кирилл.
Найти ошибку в простой задаче на языке С Дан год. Определить век и сколько лет прошло с его начала
#include int main () { int a, b, c; scanf("%d", &a); b = a/100 + 1; c = a%100; printf("%d ", b); printf(" %d", c); return 0 }

Ответы на вопрос

Отвечает Дондокова Наташа.
#include <stdio.h>
#include<conio.h>
int main (int argc, char *argv[])
{
int a, b, c;
scanf("%d", &a);
b = a/100 + 1;
c = a%100;
printf("Vek = %d\n", b);
printf("Kol-vo let s nachala = %d", c);
getch();
}
#include<conio.h>
int main (int argc, char *argv[])
{
int a, b, c;
scanf("%d", &a);
b = a/100 + 1;
c = a%100;
printf("Vek = %d\n", b);
printf("Kol-vo let s nachala = %d", c);
getch();
}



Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.
Finding the Error in the C Language Code
The provided C language code seems to aim at determining the century and the number of years that have passed since its beginning. However, there are some issues in the code that need to be addressed.
The given code is as follows:
```c
#include
Identifying the Error
The issue in the code is related to the uninitialized variables `b` and `c`. When using the `+=` operator, the variables `b` and `c` are being incremented without being initialized to a specific value. This can lead to unexpected results.Corrected Code
Here's the corrected code with the initialization of variables `b` and `c`: ```c #includeBy initializing `b` and `c` to 0, the code will now produce the expected results when determining the century and the number of years that have passed since its beginning.
I hope this helps! If you have further questions or need additional assistance, feel free to ask.


Топ вопросов за вчера в категории Информатика
Последние заданные вопросы в категории Информатика
Предметы
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili