+ 1

what wrong with this coding ?

#include<stdio.h> int main(void) { int Power, Brightness; printf("\nProgram to determine the brightness of the light bulb."); printf("\nEnter the value of power(watts):"); scanf("%d",&Power); { if (Brightness) if ("Power=15watts"); printf("125 lumens"); else if("Power=25watts"); printf("215 lumens"); else if("Power=40watts"); printf("500 lumens"); else if("Power=60watts"); printf("880 lumens"); else if("Power=75watts"); printf("1000 lumens"); else if("Power=75watts"); printf("1000 lumens"); else if("Power=100watts"); printf("1675 lumens"); else printf("-1 lumens"); return 0; } }

15th Jul 2018, 2:17 PM
Irfan Zamani
Irfan Zamani - avatar
2 Answers
+ 2
Nikhil Dhama Well done, that was a perfect explanation
15th Jul 2018, 2:49 PM
Dlite
Dlite - avatar
+ 1
Irfan Zamani use == instead of = if(brightness) // this statement will cause an error power == 12 // dont use unit and "" there should not be a ; after if condition, you should use < and > otherwise you will get an logical error. I fixed syntactical errors, now go on, try to fix logical one, all the best👍 https://code.sololearn.com/cA4wL4Gl3khJ/?ref=app 1 last suggestion, post your code in playground section and paste its link here as i did. Avoid to paste whole code in the Q/A section.
15th Jul 2018, 2:29 PM
Nikhil Dhama
Nikhil Dhama - avatar