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 |
write a programming in c to find the sum of all elements in an array through function.
how to print value of e(exp1)up to required no of digits after decimal?
How can I read and write comma-delimited text?
Write a program to find the given number is odd or even without using any loops(if,for,do,while)
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
What is the importance of c in your views?
define switch statement?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
Write a program that receives as input a number omaadel-n-print, four digits.
what are bit fields? What is the use of bit fields in a structure declaration?
0 Answers Flextronics, TISL, Virtusa,
main() { int ptr[] = {1,2,23,6,5,6}; printf("%d",&ptr[3]-&ptr[0]); }
Explain following declaration int *P(void); and int (*p)(char *a);