write a program to swap Two numbers without using temp variable.
Answer Posted / sneha chorghade
#include<stdio.h>
void main()
{
int a=2,b=3;
printf("before swap the value is:::");
printf("a=%d\tb=%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("after swap the value is:::");
printf("a=%d\tb=%d",a,b);
}
Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is const keyword in c?
What functions are used in dynamic memory allocation in c?
Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
Explain data types & how many data types supported by c?
while initialization of array why we use a[][2] why not a[2][]...?
What is function definition in c?
What is static function in c?
What are disadvantages of C language.
Why C language is a procedural language?
Explain the advantages and disadvantages of macros.
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
Can we replace the struct function in tree syntax with a union?
What is #include in c?
write an algorithm to display a square matrix.