Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. Console.WriteLine("nested if");
  2. int c = 10;
  3. int d = 8;
  4. if (c > 9)
  5. if(d > 9)
  6. {
  7. Console.WriteLine("result 1");
  8. }
  9. else
  10. {
  11. Console.WriteLine("result 2");
  12. }
  13.  
  14. if (c > 9)
  15.  
  16. {
  17. if(d > 9)
  18. Console.WriteLine("result 1");
  19. }
  20. else
  21. {
  22. Console.WriteLine("result 2"); //why don't two 'result 2's appear ?
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement