write a program to swap two variables a=5 , b= 10 without
using third variable
Answer Posted / nagendra kumar
#include<stdio.h>
main(){
int a,b;
printf("Enter A value: ");
scanf("%d",&a);
printf("\nEnter B value: ");
scanf("%d",&b);
printf("\nThe value of A is:%d",a);
printf("\n The value of B is:%d",b);
a=a+b;
b=a-b;
a=a-b;
printf("\n The value of A is:%d",a);
printf("\n The value of B is:%d",b);
}
Is This Answer Correct ? | 20 Yes | 4 No |
Post New Answer View All Answers
What is const volatile variable in c?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
List the different types of c tokens?
Can you assign a different address to an array tag?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
What does the message "automatic aggregate intialization is an ansi feature" mean?
What is the difference between strcpy() and memcpy() function in c programming?
What is a double c?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What are the types of i/o functions?
What is typedef?
What are the different types of data structures in c?
What is the purpose of realloc()?
Write a program to print fibonacci series without using recursion?
How can you tell whether a program was compiled using c versus c++?