0

Not getting desired output

Fix the bug in this code output should be price : $12 but my output is 12 #include <stdio.h> int main() { int price = 12; price = 12; printf("%d",price); return 0; }

26th Aug 2024, 4:49 PM
Sarthak Mishra
Sarthak Mishra - avatar
9 Respuestas
+ 5
You have not used $ anywhere in the program. Have you tried to put it in the printf()?
26th Aug 2024, 4:51 PM
Lisa
Lisa - avatar
+ 2
show what you have tried
26th Aug 2024, 5:17 PM
Lisa
Lisa - avatar
+ 1
great that you found a solution!
27th Aug 2024, 10:22 AM
Lisa
Lisa - avatar
+ 1
No, I did not solve this code, this code is solved by a sololearner (Surajit Roy)
27th Aug 2024, 10:35 AM
Sarthak Mishra
Sarthak Mishra - avatar
0
Yes I have tried and it doesn't work
26th Aug 2024, 5:00 PM
Sarthak Mishra
Sarthak Mishra - avatar
0
#include<stdio.h> int main(){ int price= 12; price= 12; Printf("%d",$price); return 0; } And second time I tried this👇 #include<stdio.h> int main(){ int price= $12; price= $12; Printf("%d",$price); return 0; }
27th Aug 2024, 4:17 AM
Sarthak Mishra
Sarthak Mishra - avatar
0
would type in correct format for getting output price:$12
27th Aug 2024, 4:24 AM
Sarthak Mishra
Sarthak Mishra - avatar
0
it is printf, not Printf $ has to go inside the string, before the format specifier for the number.
27th Aug 2024, 7:03 AM
Lisa
Lisa - avatar
0
By mistake in code message I typed P But now my problem is solved
27th Aug 2024, 8:48 AM
Sarthak Mishra
Sarthak Mishra - avatar