Computer Science, asked by Anonymous, 1 year ago

GUYS PLZ PLZ ANSWER THIS QUESTION...
IT'S REALLY URGENT TOMORROW EXAM....
PLZZZ.....
.......
How to swap contents of three variables??
.......
No wrong answers allowed....plzzzz...
I willl mark as brainliest which will be the best answer....
Give me a big answer for 3 marks....plzzz plzzzzz....

Answers

Answered by anas7113
1

Answer:

Write a simple program in the C programming language to swap the numbers of three variables without using the forth variable. Make a C program by taking three variables only of integer type.  The value of a will be swapped to b, and b’s value will be swapped to c and c to a. The code of the C program is as follows –

01/* Write a simple C program to swap the values of three

02variables without taking the forth varaible */

03#include<stdio.h>

04void main()

05{

06     int a,b,c;

07     printf(" Enter values of a, b and c \n");

08     scanf("%d %d %d",&a,&b,&c);

09 

10     printf("\n a = %d",a);

11     printf("\n b = %d",b);

12     printf("\n c = %d",c);

13 

14     a=a+b+c;

15     b=a-b-c;

16     c=a-b-c;

MARK IT AS BRAINLIEST HOPE IT HELPS

Similar questions