answersLogoWhite

0

#include <iostream.h>

#include <conio.h>

class largest

{

public:

int a[10],i,b,s;

void get();

};

void largest :: get()

{

cout<<"Enter the numbers"<<endl;

for(i=0;i<10;i++)

{

cin>>a[i];

}

b=0;

for(i=0;i<10;i++)

{

if(b>=a[i])

b=b;

else

b=a[i];

}

cout<<"Largest No-"<<b<<endl;

s=0;

for(i=0;i<10;i++)

{

if((s>=a[i])&&(s!=b))

s=s;

else

s=a[i];

}

cout<<"Second Largest No-"<<s<<endl;

}

void main()

{

clrscr();

largest l;

l.get();

getch();

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is the largest prime no that is stored in 8 bit pattern?

Write your own prime number program and find out.


Write a program to convert a 2 digit BCD number into hexadecimal number?

Write a program to convert a 2-digit BCD number into hexadecimal


What is the largest number you can write using the multiples of 3?

There is no largest number. You can just keep going.


What is the largest number that is possible to write?

infinity


Is it possible to write the largest natural number?

No.


How to write a program that ask user to enter numbers until user enter- 0 then find the biggest of entered numbers in C programming using while or do while?

int i, largest=0;do { scanf ("Enter a number (0 to exit): %d", i); if (i&gt;largest) largest=i; } while (i!=0); printf ("Largest number is: %d\n", largest);


2 Write a program to convert a 2-digit BCD number into hexadecimal?

WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL


What is the largest number you can write with two digits?

99


How do you write a program to find out largest number between two numbers using ternary operators?

// assume you want the find the largest of ints a,b,c: int max = (a&gt;b&amp;&amp;a&gt;c?a:b&gt;c?b:c);


Write an algorithm to read two numbers then display the largest?

Read 2 numbers. If first is larger than second, display second, else display first. That's for the smallest. For the largest reverse the two. For each of the other two, it's easier to just create a variable, call it largest. Initialize it to a very small number, say -1. As you read each number, compare it to largest. If the number is larger than largest, set largest equal to the number. When you finish each list of numbers, then print largest. Best answer Read 2 numbers. If first is larger than second, display second, else display first. That's for the smallest. For the largest reverse the two. For each of the other two, it's easier to just create a variable, call it largest. Initialize it to a very small number, say -1. As you read each number, compare it to largest. If the number is larger than largest, set largest equal to the number. When you finish each list of numbers, then print largest.


What is the largest six digit number you can write using the numbers 381724?

874321 is the largest number made from all these digits.


Write a program which takes any number of days from the user the program should display the number of years number of months formed by these days as well as the remaining days?

Write a program which takes any number of days from the user. the program should display the number of years, number of months formed by these days as well as the remaining days.