Friday, October 30

Program to find Odd numbers in the given range using C++

#include<iostream.h>
#include<conio.h>
void main()
{
            int rem, Start_Num, End_Num;
            clrscr();
            cout <<" Please Enter the Start and End numbers:\n";

            cin >> Start_Num >> End_Num;
            cout <<" The odd numbers in the ranges are \n";

            while  (Start_Num <= End_Num){
                        rem = Start_Num % 2;
                        if (rem != 0)
                                    cout<<"\t" <<Start_Num;

                        Start_Num++;
            }
}

2 comments:

  1. There is mistake in the if statment.Can you correct it.

    ReplyDelete
  2. Hi Venkatesh,

    There ia a problem in publishing the blog. I have entered the program correctly but while publishing it taking some thing else. will correct... pls be visiting the blog.....

    ReplyDelete