Advertisement
DrAungWinHtut

branch.c

May 10th, 2023
785
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. //branching with if
  2. #include<stdio.h>
  3. int main()
  4. {
  5.     printf("branching with if \n\n");
  6.     int number;
  7.     printf("Please enter a number: ");
  8.     scanf("%d",&number);
  9.     if(number>0)
  10.     {
  11.        printf("The number is positive\n");
  12.     }
  13.     else if(number<0)
  14.     {
  15.         printf("The number is negative\n");
  16.     }
  17.     else
  18.     {
  19.         printf("The number is zero\n");
  20.     }
  21.    
  22.    
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement