SHARE
TWEET

s

a guest Dec 9th, 2019 135 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int i, n;
  6.    
  7.     /* Input upper limit from user */
  8.     printf("Print odd numbers till: ");
  9.     scanf("%d", &n);
  10.  
  11.     printf("All odd numbers from 1 to %d are: \n", n);
  12.  
  13.     /* Start loop from 1 and increment it by 1 */
  14.     for(i=1; i<=n; i++)
  15.     {
  16.         /* If 'i' is odd then print it */
  17.         if(i%2!=0)
  18.         {
  19.             printf("%d\n", i);
  20.         }
  21.     }
  22.  
  23.     return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top