Advertisement
jbn6972

If else statemnts in C

Apr 18th, 2023 (edited)
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.93 KB | None | 0 0
  1. // Online C compiler to run C program online
  2. #include <stdio.h>
  3.  
  4. int main() {
  5.     // Write C code here
  6.     // printf("Hello world");
  7.     // if(a>b){
  8.     //     printf("a>b");
  9.     // }
  10.  
  11.    
  12.     // Simple If Statement
  13.     if(condition){
  14.         // True BLock
  15.     }
  16.    
  17.     // If else Statement
  18.     if(conditon){
  19.         // True Block
  20.     }else{
  21.         // False Block
  22.     }
  23.  
  24.     // Nested if else statement
  25.     if(condition1){
  26.         // True block of outer if
  27.         if(condition2){
  28.             // True block of inner if
  29.         }else{
  30.             // False block of inner if
  31.         }
  32.     }else{
  33.         // False block of outer if      
  34.     }
  35.  
  36.     // else if ladder statement
  37.     if(conditon1){
  38.         // 1st if True Block
  39.     }else if(condition2){
  40.         // 2nd if True Block
  41.     }else if(condition3){
  42.         // 3rd if True Block
  43.     }else{
  44.         // last False Block
  45.     }
  46.  
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement