+ 1
This isn't running
#include <stdio.h> void main() { float a,b,s,p,d; printf("enter the values",a,b); Scanf("%f %f"&a !&b); s=a+b; P=a*b; D=a-b; printf("The values are"s,P,D); Scanf ("%f %f %f" &s ,&P ,&D); Getch(); }
5 odpowiedzi
+ 10
Complete the C language course available on sololearn then you will able to write this code.
Here is your solution:
https://code.sololearn.com/c5P2L5Ewc5Ja/?ref=app
+ 3
Ashwini
Write .2f to get output upto 2 decimal
+ 2
1. The standard main is int main.
2. what are a, b in printf?
3. scanf has to be written in small letters and where are the commas in &a, &b.
4.C is case sensitive, so P = a*b is different from p = a*b.
6.Why is scanf over there?
7.getch() is a function which is not a c standard library function any more.
Conclusion:
I think you don't know how format strings, case sensitivity and functions work or you are using turbo c compiler. Turbo c does not support modern os and I'd designed for ms dos. Use GCC and vs code for c and learn c from a good source.
Here is the fixed code for gcc:
#include <stdio.h>
int main()
{
float a,b,s,p,d;
printf("enter the values\n");
scanf("%f %f",&a ,&b);
s=a+b;
p=a*b;
d=a-b;
printf("Sum=%f, Multi=%f, Divi=%f",s,p,d);
return 0;
}
Thanks to K.S.S. KARUNARATHNE for his working code.
+ 1
#include <stdio.h>
int main()
{
float a,b,s,p,d;
printf("enter the values\n");
scanf("%f %f",&a ,&b);
s=a+b;
p=a*b;
d=a-b;
printf("Sum=%f, Multi=%f, Divi=%f",s,p,d);
return 0;
}
+ 1
I Am AJ ! Thank you, sir.