Computer Science, asked by ignatiusamarachi22, 10 hours ago

3 Write a
program to compare two no's and then print the square
and cube of the larger number among these no's

Answers

Answered by devindersaroha43
0

Answer:

Explanation:

Before attempting any question try to make an algorithm for it.

In this question you have to take a limit as an input from user and then run a loop until that limit reached.After that in the loop try to find which number is even or odd.

I will tell you 3 ways to how to find even number.

Suppose first number is i=2.Now in if condition you can write if( (i/2)*2 == i) which gives you even number then print i*i.

Second method is a common method you can use modulus function like if( i%2==0) then print i*i.

Another method is using AND (&). To check number is even or not. If( (i & 1) ==0) then you can print i*i.

Try any one condition you will find even number after that in else you just have to print pow(i,3) or i*i*i.

If you dont understand anything then let me know

Answered by yashveersingj27
0

Answer:

this is answer okay sudbdbr fehueuwjebeheuehrud7ehbrhdhev

Attachments:
Similar questions