#include<stdio.h>
#include<conio.h>
# define swap(a,b) temp=a; a=b; b=temp;
void main( )
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i > j)
swap( i, j );
printf( "%d %d %d", i, j, temp);
}
Answer Posted / rohit751
Hi all...the main mistake in the program is using the semi
colons in the macro definition. Try this..
#include<stdio.h>
#include<conio.h>
# define swap(a,b) temp=a, a=b, b=temp;
void main( )
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i < j)
swap( i, j );
printf( "%d %d %d", i, j, temp);
}
Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
Can you think of a logic behind the game minesweeper.
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
If null and 0 are equivalent as null pointer constants, which should I use?
Can you add pointers together? Why would you?
how to write optimum code to divide a 50 digit number with a 25 digit number??
What is a char in c?
Why flag is used in c?
What is return type in c?
Explain continue keyword in c
Write a program to swap two numbers without using third variable?
Explain indirection?
Is c object oriented?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
Why do we use int main?
How can I sort more data than will fit in memory?