How do we swap or interchange any 2 numbers without using
Temporary variable...Anybody can pls answer it.. Thanks in
Advance
Answer Posted / divya
#include<stdio.h>
main()
(
clrscr();
int a,b;
printf("enter a and b values");
scanf("%d \n %d",&a,&b);
printf("before swaping a value is:%d",a);
printf("before swaping b value is:%d",b);
a=a+b;
b=a-b;
a=a-b;
printf("after swaping a value is:%d",a);
printf("after swaping b value is:%d",b);
getch();
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is realloc in c?
c language interview questions & answer
Write a program to print fibonacci series using recursion?
What is dynamic variable in c?
Do you know the difference between exit() and _exit() function in c?
What is the role of this pointer?
please send me the code for multiplying sparse matrix using c
Why calloc is better than malloc?
What is c programming structure?
What is structure and union in c?
What is header file in c?
What are pragmas and what are they good for?
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
List some of the dynamic data structures in C?
What is assignment operator?