C   85
exit c
Guest on 11th February 2023 01:22:10 PM


  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5.     int x;
  6.     printf("Enter a positive number ");
  7.     scanf("%d", &x);
  8.  
  9.     if (x < 0) {
  10.         printf("You entered a negative number\n");
  11.         return 1;
  12.     }
  13.  
  14.     x++;
  15.     printf("The incremented number is %d\n", x);
  16.     return 0;
  17. }

Raw Paste

Login or Register to edit or fork this paste. It's free.