I apologize for my bad grammar and spelling in advance.
I’m trying to learn C, but when I run code in cs50.dev I’m getting different results from when I run it in VS Code.
Here is the code
#include <stdio.h>
// Print Fharenheit-Celsius table for fahr = 0, 20, ..., 300
int main()
{
float fhar, celsius;
float lower, upper, step;
lower = 0; // Lower limit of temperature
upper = 300; // Higher limmit of temperature
step = 20; // step size //
printf("\nFhar Celsius\n----------------------\n"); // underlining table
fhar = lower;
while (fhar<=upper)
{
celsius = 5.0 * (fhar-32.0) / 9.0;
printf("%3.0f |\t %6.1f\n", fhar, celsius); // after using $f for example always add what your referancing and by order // seperating table
fhar = fhar + step;
}
}
//print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300
This is the result I get in VS Code
Ah, I can only upload 1 screen shot. The result I’m getting in cs50.dev is only showing Fhar and Celsius headers once, and only displaying the ------------- once
I’m just rather confused, have I set up VS Code wrong? Or am I in way over my head?
I hope I made sense and you were able to understand what I’m getting at.
Sorry for the formatting , I’m really not sure what I’m doing lol