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'
2 0

Rakhim D.

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

0

R. D.

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

0

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
Frontend Developer icon
Profession
beginner
Development of front-end components for web applications
start anytime 10 months
Layout Designer icon
Profession
Under development beginner
Layout with the latest CSS standards
start anytime 5 months