| |
|
#1
| ||||
| ||||
| #include <iostream.h> #include <conio.h> void main() { clrscr(); int age; cout << "Enter your present age : " << endl; cin>>age; if(age==16) { cout << "Your present age is " << age << " years." << endl; cout << "You are of the right age for joining grade 10 !" << endl; } else { cout << "Your present age is " << age << " years." << endl; cout << "You are not of the right age for joining grade 10 !" << endl; } getch(); } This program takes in the age as a screen input from the user. The program tells the user whether he/she should be in grade 10 or not by using the 'IF-ELSE' command. It then prints out the appropriate message using the 'cout' command. SAMPLE INPUT 15 SAMPLE OUTPUT Your present age is 15 years. You are not of the right age for joining grade 10 !
__________________ ![]() |
![]() |
| Tags |
| age, enter, grade, print, program |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Program to enter an integer and print if it is prime or composite | bonfire | Object Oriented Programming | 1 | 22-11-2011 07:45 PM |
| Program to enter two integers and print the quotient and remainder | bonfire | Object Oriented Programming | 0 | 01-03-2011 03:06 PM |
| Program to enter an integer and print out its successor | bonfire | Object Oriented Programming | 0 | 01-03-2011 02:55 PM |
| Program to enter an integer and print if it is greater or less than 100 | bonfire | Object Oriented Programming | 0 | 01-03-2011 02:28 PM |