I'm new to c and im trying to learn how to use the scanf
function to pass in data and then the printf
function to show me the printed results.
This seems like it should be eas,y but my expected outputs do not match what gets returned. My IDE is vscode
#include <stdio.h>
#define pi 3.14159
int main()
{
float size;
float radius;
scanf("this is the value : %f",&radius);
size = (2/3)*pi*(radius*radius*radius);
printf("%f",size);
return 0;
}
here you can see what i inpute and what gets printed
After that I went to make an easier program to understand the concept and I'm getting a similar but different issue. instead of returning 0 every time now it prints the same constant
#include <stdio.h>
int main()
{
int a;
scanf("This is the value %d", &a);
printf("Input value read : a = %d", a);
return 0;
}
Here you can see the output i get for the second program
Any ideas for whats going wrong and how i could fix it?