0

Why this simple code doesn't work?

#include <iostream> using namespace std; int main() { double length = 5.6; double height = 3.1; double area = lenght * height; cout<< area; }

2nd Jan 2023, 12:49 PM
Andra
2 Réponses
+ 8
You have defined length and height as variables, but you are using lenght in the area calculation. Change the line double area = lenght * height; to double area = length * height; and the code should work as expected. https://code.sololearn.com/cGwrcr7ljw2j/?ref=app
2nd Jan 2023, 1:35 PM
Sadaam Linux
Sadaam Linux - avatar
0
You have length misspelled in your area assignment. Don't forget to check error logs, sometimes they can be useful (and at times confusing haha). ;)
2nd Jan 2023, 1:04 PM
Bloody Halos
Bloody Halos - avatar