Question Andrew Titov in lesson «Variables and loops in C», course «Intro to C programming language»

Andrew Titov

Execution is counted, but the test gives a message.

// BEGIN (write your solution here)


int main(void) {
    int lower, upper, step, celsium, kelvin;
    lower = 0;
    upper = 300;
    step = 20;

    celsium = lower;

    while(celsium <= upper) {
        kelvin = celsium + 273;
        printf("%d : %d\n", celsium, kelvin);

        celsium = celsium + step;
    }
return 0;


}

// END
make: Entering directory `/usr/src/app'
rm -f solution
gcc -g -Wall solution.c -o solution
solution.c: In function ‘main’:
solution.c:13:9: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
         printf("%d : %d\n", celsium, kelvin);
         ^
solution.c:13:9: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
make: Leaving directory `/usr/src/app'

Rakhim D.

I'll fix this exercise, but for now try adding #include <stdio.h> to the top of your file.

R. D.

Oh wait, it's there already. Hmm, gotta look into it.

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Suggested learning programs
profession
Development of front-end components for web applications
10 months
from scratch
Start at any time
profession
Layout with the latest CSS standards
5 months
from scratch
under development
Start at any time
profession
new
Developing web applications with Django
10 months
from scratch
under development
Start at any time