+ 1

Type conversion confusion

Look at the comented text below : #include <stdio.h> int main() { float average; int total = 23; int count = 4; #in this code. when we are not using float its output get change to 5.00 . Why...???? average = (float)total / count; printf("%4.2f", average); return 0; }

1st Jun 2020, 5:57 AM
Anjali Singh
Anjali Singh - avatar
2 ответов
+ 2
Oo.. ok. Thanks, i got it..😊
1st Jun 2020, 6:21 AM
Anjali Singh
Anjali Singh - avatar
+ 1
Go through this...might help #include <stdio.h> int main() { float average; int total = 23; int count = 4; #in this code. when we are not using float its output get change to 5.00 . Why...???? average = (float)total / count; printf("%4.2f", average); return 0; }
25th Jun 2020, 11:38 PM
Sydney James Njiiri
Sydney James  Njiiri - avatar