0

Somebody please help me to understand!

#include<stdio.h> int main() { float a=3.0,b=4.0,c=5.0,d=6.0; printf("a+b-c=%f\n", a+b-c); printf("b%%a-c+b/a=%f\n", b%a-c+b/a); return 0; } error: invalid operands to binary expression ('float' and 'float') printf("b%%a-c+b/a=%f\n", b%a-c+b/a); ~^~

12th May 2020, 2:54 PM
chaitanya bezawada
chaitanya bezawada - avatar
3 Réponses
+ 2
#include<stdio.h> int main() { int a=3,b=4,c=5; printf("a+b-c=%d\n", a+b-c); printf("b%%a-c+b/a=%d\n", b%a-c+b/a); return 0; } moduls operator float nihi leta use int
12th May 2020, 3:10 PM
Shailja Khare
+ 1
Modulo operator is not defined for float. Use the following instead. #include <math.h> printf("%f", fmod(4.0, 3.5));
12th May 2020, 3:16 PM
Manu_1-9-8-5
Manu_1-9-8-5 - avatar
0
Thank you
12th May 2020, 3:29 PM
chaitanya bezawada
chaitanya bezawada - avatar