answersLogoWhite

0


Best Answer

#include<iostream>

#include<time.h>

// return a reference to the largest of two objects of the same type

template<typename T>T& largest (T& a, T& b) {

return a<b?b:a;

}

int main() {

// seed the random number generator

srand ((unsigned) time (0));

// repeat 10 times

for (size_t loop=0; loop<10; ++loop)

{

// select two random integers

int x = rand()%10;

int y = rand()%10;

// print the result

if (x==y)

cout << x << " & " << y << " are equal" << endl;

else

cout << "The largest of " << x << " & " << y << " is " << largest (x,y) << endl;

} // end for loop

}

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,c;

clrscr();

printf("Enter the 1st No.: ");

scanf("\n%d",&a);

printf("Enter the 2nd No.: ");

scanf("\n%d",&b);

if (a=b)

{

printf("The numbers are equal");

}

else if (a>b)

{

printf("The 1st No. is big");

}

else

{

printf("The 2nd No. is big");

}

getch();

}

\\This is the program to find whether the entered no.s are same, greater or smaller.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

#include<stdio.h>

void main()

{

int a,b;

printf("enter two numbers");

scanf("%d %d",&a,&b);

if(a==b)

{

printf("2 numbers are equal");

}

else

{

printf("not equal");

}

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program to check whether the given two numbers are equal. If not then find the greater of the given two numbers.?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

A flowchart to Accept three numbers and check whether it firms to Pythagorean triplet?

Accept 3 natural numbers and check whether it firms pythagorean triplet


Write a simple program algorithms flow charts to find out how many of the numbers from 1 to 10 is greater than 4?

/* c program for how many of the numbers from 1 to 10 is greater than 4? */#includevoid main(){int i ,j=0; /* j is used for counting the nos greater than 4 from 1 to 10*/for(i=1;i4)j++;printf("\n The numbers greater than 4 , from 1 to 10 is %d",j);}Algorithmstep 1:startstep 2 :initialize j=0step 3 :Initialize i=1,check whether i < 10 ,if true increment i else go to step 6step 4: check whether i >4 If true go to step5 ,else go to step 3step 5 :Increment j and then go to step 3step 6:print the value of jstep 7 :Stop


How do you print non-prime numbers in java?

Loop through some numbers - for example, 2 through 100 - and check each one whether it is a prime number (write a second loop to test whether it is divisible by any number between 2 and the number minus 1). If, in this second loop, you find a factor that is greater than 1 and less than the number, it is not a prime, and you can print it out.


Write a c program to check whether a string follows English capitalization rules?

Active Time spent online


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.

Related questions

A flowchart to Accept three numbers and check whether it firms to Pythagorean triplet?

Accept 3 natural numbers and check whether it firms pythagorean triplet


Can these lengths make a triangle 5.0 4.8 9.1?

Check whether the largest of the numbers is greater than or equal to the sum of the other two. If it is, then you can't make a triangle; otherwise you can.


Can 9 7 16 form a triangle?

Pick out the largest number, and check whether it is less than the sum of the other two numbers. If it is less, then you can. If it is greater or equal, then you can't.


Write a program By using if else statement to read a number and check whether it is positive or negative?

write a c++program by using if statement to read a number and check whether it is positive or negative


Write a simple program algorithms flow charts to find out how many of the numbers from 1 to 10 is greater than 4?

/* c program for how many of the numbers from 1 to 10 is greater than 4? */#includevoid main(){int i ,j=0; /* j is used for counting the nos greater than 4 from 1 to 10*/for(i=1;i4)j++;printf("\n The numbers greater than 4 , from 1 to 10 is %d",j);}Algorithmstep 1:startstep 2 :initialize j=0step 3 :Initialize i=1,check whether i < 10 ,if true increment i else go to step 6step 4: check whether i >4 If true go to step5 ,else go to step 3step 5 :Increment j and then go to step 3step 6:print the value of jstep 7 :Stop


What is a Desk check trace table?

Going through a program on paper to check whether it has errors.


How do you check whether two IMEI numbers are of one mobile?

samsung


Is 21 and 35 relatively prime?

You need to check whether they have a common factor. You can simply factor each of the numbers; for numbers that are much larger, using Euclid's algorithm is much faster.If the common factor of two numbers is greater than 1, then they are NOT relatively prime.


Is sequence 3 9 91 6561 A arithmetic B geometric or c neither?

To check whether it is an arithmetic sequence, verify whether the difference between two consecutive numbers is always the same.To check whether it is a geometric sequence, verify whether the ratio between two consecutive numbers is always the same.


How do you find prime numbers between 2 and 70?

You can check each individual number, whether it is a prime number. For numbers below 100, it is enough to check whether they are divisible by 2, by 3, by 5, and by 7. If a number is divisible by none of these, it is a prime number.


Shell program for gcd of three given numbers?

write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html


Can you write a C program to check whether a string is an IP address or not?

Use the Exception class and type converters.