wap in c to accept n number display the highest and lowest
value

Answers were Sorted based on User's Feedback



wap in c to accept n number display the highest and lowest value..

Answer / abhilash.d

void main()
{
int n,a[],j,l;
printf("enter the no.of numbers to accept");
scanf("%d",&n);
printf("enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=1;j<=i;j++)
{
if(a[i]<a[j])
{
l=a[i];
a[j]=a[i];
a[i]=l;
}
}
}
printf("highest value is:"a[0]);
printf("lowest value is:"a[0+n-1]);
}

Is This Answer Correct ?    10 Yes 3 No

wap in c to accept n number display the highest and lowest value..

Answer / raghu

void main()
{
int n,a[],j,l,max,min;
printf("enter the no.of numbers to accept");
scanf("%d",&n);
printf("enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]<=min)
{
min=a[i];
}
else if(a[i]>=max)
{
max=a[i];
}
}
printf("highest value is:",max);
printf("lowest value is:",min);
}

Is This Answer Correct ?    7 Yes 5 No

Post New Answer

More C Interview Questions

What is a void pointer in c?

0 Answers  


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

0 Answers   Wilco,


wap in c to accept n number display the highest and lowest value

2 Answers  


What is wrong with this program statement?

0 Answers  


How we can insert comments in a c program?

0 Answers  






WHAT IS INT?

8 Answers   Accenture,


What kind of sorting is this? SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort

3 Answers   Accenture,


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

0 Answers  


what is the difference between #include<stdio.h> and #include "stdio.h" ?

3 Answers  


What is that continue statement??

4 Answers  


int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); a++; }while(a!=0); return 0; } can anyone please explain me output????

1 Answers  


Write a c program to find, no of occurance of a given word in a file. The word is case sensitive.

2 Answers  


Categories