#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
int main(){
int number;
int minNumber=10000000;
int maxNumber=-10000000;
//Ask the user to enter 10 positive integers and find the maximum and minimum number,
printf("Enter 10 numbers:\n");
for(int i=0;i<10;i++){
scanf("%d",&number);
//if the user enters a negative number exit the program displaying the message “NOT COOL”.
if(number<0){
printf("\nNOT COOL\n");
//We can exit the program using exit(1); statement.
exit(1);
}
if(number<minNumber){
minNumber=number;
}
if(number>maxNumber){
maxNumber=number;
}
}
//If all numbers are positive display the maximum and minimum numbers as well as if they are even or odd.
if(maxNumber%2==0){
printf("The maximum number is %d and it is an Even Number\n",maxNumber);
}else{
printf("The maximum number is %d and it is an Odd Number\n",maxNumber);
}
if(minNumber%2==0){
printf("The minimum number is %d and it is an Even Number\n",minNumber);
}else{
printf("The minimum number is %d and it is an Odd Number\n",minNumber);
}
getchar();
getchar();
return 0;
}
Comments
Leave a comment