Thursday, 17 October 2013

CPP Program to Print January, February...................December Using If.

//Write a program to print January, February…………….December using if.
#include<iostream.h>
#include<conio.h>
void main()

{
clrscr();
int c;
cout<<”Enter your choice: “;
cin>>c;
cout<<endl;
if(c==1)
cout<<”January”;
else if(c==2)
cout<<”February”;
else if(c==3)
cout<<”March”;
else if (c==4)
cout<<”April”;
else if(c==5)
cout<<”May”;
else if(c==6)
cout<<”June”;
else if (c==7)
cout<<”July”;
else if(c==8)
cout<<”August”;
else if(c==9)
cout<<”September”;
else if(c==10)
cout<<”October”;
else if(c==11)
cout<<”November”;
else if(c==12)
cout<<”December”;
else
cout<<”Invalid Input”;

getch();
}

Output:

No comments:

Comments System