write a program to sort the elements in a given array in c
language
Answer Posted / rajesh evani
#include<stdio.h>
void main()
{
int a[5],t;
int i,j=0;
printf("enter 5 values into the array a");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
printf("the sorted order of elements");
for(i=0;i<5;i++)
{
for (j=0;j<5;j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
for(i=0;i<5;i++)
{
printf("%d",a[i]);
}
}
| Is This Answer Correct ? | 225 Yes | 62 No |
Post New Answer View All Answers
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
How can you check to see whether a symbol is defined?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
What are the uses of null pointers?
Explain what are reserved words?
number of times a digit is present in a number
Is main is user defined function?
Difference between goto, long jmp() and setjmp()?
Are negative numbers true in c?
Should I learn c before c++?
Can you please explain the scope of static variables?
Explain how do I determine whether a character is numeric, alphabetic, and so on?
Differentiate between ordinary variable and pointer in c.
What is difference between %d and %i in c?
Differentiate between null and void pointers.