0% found this document useful (0 votes)
22 views1 page

Solution To Problem Set 1 Question No.6: Program

This C program accepts two float values as input, stores them in variables a and b, then uses a temporary variable temp to swap the values of a and b. It prints the swapped values of a and b after swapping them using the temporary variable.

Uploaded by

pontas97
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

Solution To Problem Set 1 Question No.6: Program

This C program accepts two float values as input, stores them in variables a and b, then uses a temporary variable temp to swap the values of a and b. It prints the swapped values of a and b after swapping them using the temporary variable.

Uploaded by

pontas97
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Solution to Problem Set 1 Question No.

6 :
Program:
/* Program to accept two values as inputs in two variables and swap them
*/
#include<stdio.h>
void main()
{
float a,b,temp;
clrscr();
printf("Enter two numbers:");
scanf("%f %f",&a,&b);
temp=a;
a=b;
b=temp;
printf("The numbers after swapping are:%f and %f",a,b);
getch();
}

You might also like