Results 1 to 2 of 2

Thread: display all the odd numbers between the range the user inputs

  1. #1
    Join Date
    Sep 2010
    Posts
    11

    display all the odd numbers between the range the user inputs

    ****************** Display all the odd numbers
    between the range the user inputs ************

    I need help putting this into c language^^^

    I tried to write it out but I'm not sure how to convert it to C language...

    get inputs from user with scanf
    check if the minimum number is odd or even
    if odd
    print minimum number, then add 2, add 2, add 2... to n
    if even
    add 1, then add 2, add 2, add 2, add 2... to n

  2. #2
    Join Date
    May 2006
    Posts
    21

    Re: display all the odd numbers between the range the user inputs

    Try the following code

    Code:
    #include <stdio.h>
    
    main()
    {
    int i,num;
    clrscr();
    printf("\n Input the range upto which you want to print "); 
    scanf("%d",&num);
    for(i=1;i<num;i=i+2)
    { 
    printf("\n%d",i);
    }
    getch();
    }

Similar Threads

  1. How delete rows between two inputs numbers on Excel?
    By Hridayeshu in forum Windows Software
    Replies: 1
    Last Post: 04-01-2012, 07:56 PM
  2. Need Video Display Inputs on HP TouchSmart 600-1120la
    By MACALL in forum Portable Devices
    Replies: 5
    Last Post: 11-08-2011, 10:31 PM
  3. Replies: 1
    Last Post: 20-11-2010, 07:07 PM
  4. How to display week numbers in Outlook 2007
    By Cade in forum Windows Software
    Replies: 4
    Last Post: 06-04-2010, 06:57 AM
  5. User inputs in Batch (.bat) files
    By Gap meer in forum Software Development
    Replies: 3
    Last Post: 21-05-2009, 12:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,638,816.86228 seconds with 17 queries