Write a program in C that prints out the odd numbers between

Write a program in C++ that prints out the odd numbers between 2 and 26 using FOR loop.

Solution

Solution.cpp

#include <iostream>//header file for input output function

using namespace std;//it tells the compiler to link std namespace

int main()
{//main function
cout<<\"odd numbers between 2 and 26 are :\"<<endl;
   for(int i=2;i<26;i++)
   {
   if(26%i!=0)//logic for odd numbers
   {

   cout<<i<<\" \";
   }
   }
   return 0;
}

output

odd numbers between 2 and 26 are :

3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25

Write a program in C++ that prints out the odd numbers between 2 and 26 using FOR loop.SolutionSolution.cpp #include <iostream>//header file for input out

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site