by Dinesh Thakur Category: Control Structures

 

#include<iostream.h>

#include<conio.h>
void main()
   {
        int code;
        clrscr();
        cout<<"Enter the color code : ";
        cin>>code;
        if(code==1 )
             {
                     cout<<"Color is Red";
              }
        else if(code==2)
             {
                     cout<<" Color is Green";
             }
       else if(code==3)
            {
                     cout<<" Color is White";
             }
      else if(code==4)
             {
                    cout<<"Color is Yellow";
              }
      else
             {
                   cout<<" No Color code defined";
              }
                   cout<<endl;
                   cout<<"End of the Program ";
                   getch();
}

Ladder If Statement



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles