C Program To Swapping of 2 numbers using function

#include<stdio.h>
#include<conio.h>
void swap(float,float);
void main()
{
float a,b;
clrscr();
printf("Enter a, b: ");
scanf("%f%f",&a,&b);
swap(a,b);
getch();
}
 void swap(float a,float b)
 {
 a=a+b;
 b=a-b;
 a=a-b;
 printf("After swapping: %f  %f",a,b);
 }
Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Security Analyst, Blogger, Web Developer and a Mechanical Engineer. He Enjoys writing articles, Blogging, Debugging Errors and Capture the Flags. Enjoy Learning; There is Nothing Like Absolute Defeat - Try and try until you Succeed.

No comments:

Post a Comment