a C prog to swap 2 no.s without using variables just an
array?
Answers were Sorted based on User's Feedback
Answer / laxmi bose
#include<stdio.h>
main()
{
int a[0],a[1],a[2];
scanf("%d%d",&a[0],&a[1]);
a[2]=a[0];
a[0]=a[1];
a[1]=a[2];
printf("%d,%d",a[0],a[1]);
}
Is This Answer Correct ? | 11 Yes | 0 No |
Answer / sankar kiran
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("Enter the number:");
scanf("%d%d",&a,&b)
a=a+b;
b=a-b;
a=a-b;
printf("%d%d",a,b);
getch();
}
Is This Answer Correct ? | 14 Yes | 7 No |
Answer / jaspreet singh
void main()
{
int a[2]={20,10};
a[0]=a[0]^a[1];
a[1]=a[0]^a[1];
a[0]=a[0]^a[1];
printf("a=%d,b=%d",a[0],a[1])
getch();
}
Is This Answer Correct ? | 7 Yes | 4 No |
Answer / karthik
void main()
{
int a=10,b=20;
a^=b^=a^=b;
printf("a=%d,b=%d",a,b)
getch();
}
Is This Answer Correct ? | 8 Yes | 6 No |
Answer / baidyanath bisoyi
void main()
{
int a,b;
printf("enter the two numbers\n");
scanf("%d%d",&a,&b);
printf("a=%d\n b=%d\n",a,b);
a=a+b-(b=a);
printf("a=%d\n b=%d\n",a,b);
getch();
}
Is This Answer Correct ? | 4 Yes | 3 No |
can anyone proide me reading material on svit00ef27@yahoo.com please thanx in advance
Write a program to generate random numbers in c?
What are header files in c programming?
What are structural members?
What is masking?
Write a C program to find the smallest of three integers, without using any of the comparision operators.
what is the use of operator ^ in C ? and how it works?
write a program which counts a product of array elements lower than 10.
What is a pointer?
Program to write some contents into a file using file operations with proper error messages.
Diff between for loop and while loop?
can you change name of main()?how?