Â
The Code given below can be used in TURBO C++ Compilers: -
#include <iostream.h>
#include<conio.h>
void main()
{
clrscr();
float num;
cout << "Enter the age of a person: \n";
cin >> num;
if (num >= 18)
{
cout << "Person is in adulthood phase.";
}
else if (18 < num || num > 12)
{
cout << "Person is in teenagehood.";
}
else
{
cout << "Person is in childhood phase.";
}
getch();
}
//.............Coded by YASH ALAPURIA
The Code given below can be used in gcc/g++ Compilers: -
#include <iostream>
using namespace std;
int main()
{
float num;
cout << "Enter the age of a person: \n";
cin >> num;
if (num >= 18)
{
cout << "Person is in adulthood phase.";
}
else if (18 < num || num > 12)
{
cout << "Person is in teenagehood.";
}
else
{
cout << "Person is in childhood phase.";
}
retrun 0;
}
//.............Coded by YASH ALAPURIA
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP