English

Correct the following code sigment: if (x = 1) p = 100; else p = 10;

Advertisements

Question

Correct the following code sigment:

if (x = 1)
   p = 100; 
else
   p = 10;

Chart
Advertisements

Solution

Given Code Corrected Code
if (x = 1)
   p = 100; 
else
   p = 10;

if(x == 1)
   p = 100;
else
   p = 10;

shaalaa.com
Statements
  Is there an error in this question or solution?
Chapter 10: Flow of Control - Evaluation - Section - B [Page 178]
Advertisements
Share
Notifications



      Forgot password?
Use app×