3) Write an algorithm, flowchart and pseudo code to check if a number is odd or even if the no. is odd
print the cube of a number else print the square?
Plz don't give unhelpful answer
Answers
Answer:
i shall give you both algorithm, Flow Chart and Programme for even or odd number c programming:
Algorithm
Step 1: Start
Step 2: [ Take Input ] Read: Number
Step 3: Check: If Number%2 == 0 Then
Print : N is an Even Number.
Else
Print : N is an Odd Number.
Step 4: Exit
————————————————————————————————————-
Flowchart:
——————————————————————————————————
Programming:
//Starting Chat_PC
#include <stdio.h>
int main()
{
int number;
printf("Enter an integer: ");
scanf("%d", &number);
// True if the number is perfectly divisible by 2
if(number % 2 == 0)
printf("%d is even.", number);
else
printf("%d is odd.", number);
return 0;
}
Output
Enter an integer: -7
-7 is odd.
————————————————————————————————-
Please Note:
Zero is neither even nor odd.
The concept of Even-Odd extends to both negative and positive integers.