C

Friday, 4 August 2017

SWAPPING OF TWO VALUES WITHOUT USING THIRD VARIABLE

#include<stdio.h>
#include<conio.h>
main()
{
int a=8, b=12;
clrscr();
printf("Before swap of two numbers a=%d b=%d\n",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("After swap of numbers a=%d b=%d",a,b);
getch();
}

No comments:

Post a Comment

Write a program to draw a circle using mid-point circle drawing algorithm.

#include<iostream.h> #include<graphics.h> #include<conio.h> void drawcircle(int x0, int y0, int r) {         ...