how to swap four numbers without using fifth variable?
Answers were Sorted based on User's Feedback
Answer / srinija jilugu
#include<stdio.h>
void main()
{
int a,b,c,d;
printf("enter values\n");
scanf("%d %d %d %d",&a,&b,&c,&d);
printf("before swapping\n");
printf("%d %d %d %d",a,b,c,d);
a=(a+b);
b=(a-b);
a=(a-b);
c=(c+d);
d=(c-d);
c=(c-d);
printf("after swapping:%d %d %d %d",&a,&b,&c,&d);
}
| Is This Answer Correct ? | 23 Yes | 19 No |
Answer / rocky
#include<stdio.h>
void main()
{
int a,b,c,d;
printf("enter values
");
scanf("%d %d %d %d",&a,&b,&c,&d);
printf("before swapping
");
printf("%d %d %d %d",a,b,c,d);
a=(a+d);
d=(a-d);
a=(a-d);
c=(c+b);
b=(c-b);
c=(c-b);
printf("after swapping:%d %d %d %d",a,b,c,d);
}
| Is This Answer Correct ? | 5 Yes | 5 No |
Explain is it valid to address one element beyond the end of an array?
What is a far pointer in c?
Design a program using an array that searches a number if it is found on the list of the given input numbers and locate its exact location in the list.
how to convert binary to decimal and decimal to binary in C lanaguage
7 Answers BPO, Far East Promotions, IBM, RBS,
what is the structure pointer?
what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }
How will you divide two numbers in a MACRO?
how many keywords are available in 'c' language a) 32 b) 34 c) 45 d) 48
program that accepts amount in figures and print that in words
2 Answers Infosys, Lovely Professional University, Wipro,
Write a program to print distinct words in an input along with their count in input in decreasing order of their count
what does static variable mean?
Output for following program using for loop only * * * * * * * * * * * * * * *