Computer Science, asked by ayushusalunke14, 17 hours ago

Write a C++ program to print even and odd number in one function and print positive and negative number in another function(Using Class)​

Answers

Answered by itzPriyanka
1

Answer:

\huge\mathfrak\purple{↬Answer}

Approach:

  1. For Even numbers:

Even number are numbers that are divisible by 2.

To print even numbers from 1 to N, traverse each number from 1.

Check if these numbers are divisible by 2.

If true, print that number.

2. For Odd numbers:

Odd number are numbers that are not divisible by 2.

To print Odd numbers from 1 to N, traverse each number from 1.

Check if these numbers are not divisible by 2.

If true, print that number.

hope it helps ❤

Similar questions