Question #15460

Write a program that reads in two integers and prints which value is larger

Expert's answer

#include<iostream.h>

int q, p;

void main(){

cout<<"Enter the first integer: ";

cin>>q;

cout<<"Enter the secondt integer: ";

cin>>p;

if (p>q) cout<<"The second integer is larger.\n";

if (p<q) cout<<"The first integer is larger.\n";

if (p==q) cout<<"The given integers are equal.\n";

}

int q, p;

void main(){

cout<<"Enter the first integer: ";

cin>>q;

cout<<"Enter the secondt integer: ";

cin>>p;

if (p>q) cout<<"The second integer is larger.\n";

if (p<q) cout<<"The first integer is larger.\n";

if (p==q) cout<<"The given integers are equal.\n";

}

## Comments

## Leave a comment