1. Program to find largest number without using any DATA STRUCTURE
Program to find largest number without using any DATA STRUCTURE
Program :-#include <iostream>
int main()
{
int n,a,b,c,i;
std::cout<<"How many numbers you want to enter :- "<<"\n";
std::cin>>n;
std::cout<<"Enter no 1 :- ";
std::cin>>a;
std::cout<<"Enter no 2 :- ";
std::cin>>b;
if(a>b)
c=a;
else
c=b;
for(i=3;i<=n;i++)
{
std::cout<<"Enter no "<<i<<" :- ";
std::cin>>a;
if(a>c)
c=a;
}
std::cout<<"Largest Number is ----> "<<c;
return 0;
}
Tips-
1] Editor used - Devcpp
2] Replace std::cout & std:;cin win cout and cin respectively for other compilers.
1. Program to find largest number without using any DATA STRUCTURE
Reviewed by Unknown
on
3:48:00 AM
Rating:
No comments: