+ 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(); }

29th Dec 2020, 3:03 AM
Ravi Pandey
Ravi Pandey - avatar
5 Respostas
+ 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
29th Dec 2020, 3:26 AM
Ashwini Adsule
Ashwini Adsule - avatar
+ 3
Ashwini Write .2f to get output upto 2 decimal
29th Dec 2020, 4:18 AM
A͢J
A͢J - avatar
+ 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.
29th Dec 2020, 8:14 AM
Muzammil
Muzammil - avatar
+ 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; }
29th Dec 2020, 3:41 AM
K.S.S. Karunarathne
K.S.S. Karunarathne - avatar
+ 1
I Am AJ ! Thank you, sir.
3rd Jan 2021, 10:39 AM
Ashwini Adsule
Ashwini Adsule - avatar