write a origram swaoing valu without 3rd variable
Answers were Sorted based on User's Feedback
Answer / jeevanvns
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter the valu");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("%d\t %d\t",a,b);
getch();
}
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / tejesh
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter the value");
scanf("%d%d",&a,&b);
a=a^b; //xor operator -- ^
b=a^b;
a=a^b;
printf("%d\t %d\t",a,b);
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Print an integer using only putchar. Try doing it without using extra storage.
void pascal f(int i,int j,int k) { printf(ā%d %d %dā,i, j, k); } void cdecl f(int i,int j,int k) { printf(ā%d %d %dā,i, j, k); } main() { int i=10; f(i++,i++,i++); printf(" %d\n",i); i=10; f(i++,i++,i++); printf(" %d",i); }
prog. to produce 1 2 3 4 5 6 7 8 9 10
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above
Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }
main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }
Is the following code legal? struct a { int x; struct a *b; }
Write a C program to add two numbers before the main function is called.
Develop a routine to reflect an object about an arbitrarily selected plane
int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }