how to find the largest of given numbers in an array

Answers were Sorted based on User's Feedback



how to find the largest of given numbers in an array..

Answer / jvhariharan

void main()
{
int a[10],i,max,m;
pf("enter the range of array");
sf("%d",&m);
pf("enter the values:");
for(i=0;i<m;i++)
{sf("%d",&a[i]);
}
max=a[0];
for(i=1;i<m;i++)
{if(a[i]>max)
{max=a[i];
}}
pf("the max no:%d",max);
}

Is This Answer Correct ?    12 Yes 0 No

how to find the largest of given numbers in an array..

Answer / anmol.s.fattepur

void ANMOL()
{
int a[10],i,max,m;
pf("enter the range of array");
sf("%d",&m);
pf("enter the values:");
for(i=0;i<m;i++)
{sf("%d",&a[i]);
}
max=a[0];
for(i=1;i<m;i++)
{if(a[i]>max)
{max=a[i];
}}
pf("the max no:%d",max);
}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More OOPS Interview Questions

What is the correct syntax for inheritance? 1) class aclass : public superclass 2) class aclass inherit superclass 3) class aclass <-superclass

6 Answers   Wipro,


What is abstraction?

9 Answers  


What are the two different types of polymorphism?

0 Answers  


why the argument is passed by reference to a copy constructor?example?

2 Answers  


Why is polymorphism important in oop?

0 Answers  


why reinterpret cast is considered dangerous?

0 Answers   TCS,


Write an operator overloading program to write S3+=S2.

2 Answers  


what about you? wahat is your object? introduce your self?

1 Answers   Ajmal Perfumes, TCS,


What is virtual class and friend class?

5 Answers   IBS, Intel, Wipro,


What is static modifier?

0 Answers  


Why is polymorphism used?

0 Answers  


What is the difference between class and structure?

7 Answers  


Categories