Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



display all the odd numbers between the range the user inputs

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 17-11-2010
Member
 
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

Reply With Quote
  #2  
Old 22-11-2010
Member
 
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();
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "display all the odd numbers between the range the user inputs"
Thread Thread Starter Forum Replies Last Post
How delete rows between two inputs numbers on Excel? Hridayeshu Windows Software 1 04-01-2012 06:56 PM
Need Video Display Inputs on HP TouchSmart 600-1120la MACALL Portable Devices 5 11-08-2011 10:31 PM
calculate the sum of all the even numbers between the range the user inputs MaryJ Software Development 1 20-11-2010 06:07 PM
How to display week numbers in Outlook 2007 Cade Windows Software 4 06-04-2010 06:57 AM
User inputs in Batch (.bat) files Gap meer Software Development 3 21-05-2009 12:06 PM


All times are GMT +5.5. The time now is 11:33 PM.