Write a program that declares and initializes two numbers with your roll no and your friend roll no and displays the greater of the two

Declares and initializes two numbers and displays the greater of the two

Write a program that declares and initializes two numbers with your roll no and your friend roll no and displays the greater of the two

Object: Write a program that declares and initializes two numbers with your roll no and your friend roll no and displays the greater of the two C++ projects for beginners with source code

Code:

#include<iostream>

#include<conio.h>

using namespace std;

void main()

{

       int rol_1,rol_2;

       cout<<“Enter Jon Roll Number: “;

       cin>>rol_1;

       cout<<“\nEnter James Roll Number: “;

       cin>>rol_2;

       if(rol_1>rol_2)

       {

              cout<<“\Jon Roll Number is Greater Than James.”;

       }

       else

       {

              cout<<“\James Roll Number is Greater Than Jon.”;

       }

       getch();
}

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
	int rol_1,rol_2;
	cout<<"Enter Jon Roll Number: ";
	cin>>rol_1;
	cout<<"\nEnter James Roll Number: ";
	cin>>rol_2;
	if(rol_1>rol_2)
	{
		cout<<"\Jon Roll Number is Greater Than James.";
	}
	else
	{
		cout<<"\James Roll Number is Greater Than Jon.";
	}
	getch();
}

Output:

Write a program that declares and initializes two numbers with your roll no and your friend roll no and displays the greater of the two

 

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *