how to write a bubble sort program without using temporary
variable?
Answer / nitin garg
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
int num[100],n,i,j;
printf("how many elements you enter
");
scanf("%d",&n);
printf("Enter %d elements
",n);
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(num[j]>num[i])
{
num[i]=num[i]+num[j];
num[j]=num[i]-num[j];
num[i]=num[i]-num[j];
}
}
}
printf("
Sorted in Ascending order
");
for(i=0;i<n;i++)
{
printf("%d
",num[i]);
}
getch();
}
| Is This Answer Correct ? | 15 Yes | 4 No |
can anyone please tell me wat is backlogs... i was looking for the job openings where i read this.. eligibility criteria minimum 70% in degree without backlogs. is that arrear.. if so is it standing arrear or history of arrears... please help me...
11 Answers CTS, Indian Navy, L&T, Microsoft, SSB, TCE, TCS,
Find errors (1) m = ++a*5; (2) a = b ++ -c*2; (3)y = sqrt (1000);
could u able to tell about suresoft technical session
Difference between macros and inline functions? Can a function be forced as inline?
0 Answers HAL, Honeywell, Zomato,
1.Why do you call C is middle level language? 2.Why do you call C is userfriendly language.
How do I swap bytes?
What is the use of f in c?
how can make variable not in registers
How many levels of pointers can you have?
Why do we need arrays in c?
What are data structures in c and how to use them?
Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will this compile?