write a program to arrange the contents of a 1D array in
ascending order
Answer Posted / rajeev
#include<stdio.h>
#include<conio.h>
void main()
{
int a[20],n,i,j,temp;
clrscr();
printf("\n enter the size of the array");
scanf("%d",&n);
printf("\n enter the contents of the array");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<(n-1)-i;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
getch();
}
Is This Answer Correct ? | 10 Yes | 12 No |
Post New Answer View All Answers
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
What is the explanation for cyclic nature of data types in c?
What is null in c?
Is fortran faster than c?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
how many key words availabel in c a) 28 b) 31 c) 32
Why calloc is better than malloc?
In a byte, what is the maximum decimal number that you can accommodate?
What is the function of multilevel pointer in c?
Write a program to identify if a given binary tree is balanced or not.
What is extern variable in c with example?
What is main () in c language?
What is the benefit of using #define to declare a constant?
Write a program to print fibonacci series using recursion?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA