#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();
}
int i, largest=0;do { scanf ("Enter a number (0 to exit): %d", i); if (i>largest) largest=i; } while (i!=0); printf ("Largest number is: %d\n", largest);
// assume you want the find the largest of ints a,b,c: int max = (a>b&&a>c?a:b>c?b:c);
write a c++ program to convert binary number to decimal number by using while statement
write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program
how to write a program that counts automorphic number from 1 to 999
Write your own prime number program and find out.
Write a program to convert a 2-digit BCD number into hexadecimal
There is no largest number. You can just keep going.
infinity
No.
int i, largest=0;do { scanf ("Enter a number (0 to exit): %d", i); if (i>largest) largest=i; } while (i!=0); printf ("Largest number is: %d\n", largest);
WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL
99
// assume you want the find the largest of ints a,b,c: int max = (a>b&&a>c?a:b>c?b:c);
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.
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.