Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

C++ Program to Compare Two Numbers, Assignments of Data Structures and Algorithms

A simple c++ program that takes two numbers as input and determines which number is greater. This program can be used as a starting point for learning basic input/output operations and conditional statements in c++.

Typology: Assignments

2020/2021

Uploaded on 02/13/2021

tau123
tau123 🇮🇳

8 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
#include <iostream>
using namespace std;
int main(){
int num1,num2;
cout<<"Enter First number: "<<endl;
cin>>num1;
cout<<"Enter Second number: "<<endl;
cin>>num2;
if (num1 > num2)
{
cout<<num1<<" is greater";
}else{
cout<<num1<<" is smaller";
}
return 0;
}

Partial preview of the text

Download C++ Program to Compare Two Numbers and more Assignments Data Structures and Algorithms in PDF only on Docsity!

#include using namespace std; int main(){ int num1,num2; cout<<"Enter First number: "<<endl; cin>>num1; cout<<"Enter Second number: "<<endl; cin>>num2; if (num1 > num2) { cout<<num1<<" is greater"; }else{ cout<<num1<<" is smaller"; } return 0; }