#include <stdio.h>
#include <conio.h>
void main()
{
float M,N;
void swap(float *ptr1, float *ptr2 ); /* Function Declaration */
printf(“Enter the values of M and N\n”);
scanf(“%f %f”, &M, &N);
printf (“Before Swapping:M = %5.2f\tN = %5.2f\n”, M,N);
swap(&M, &N);
printf (“After Swapping:M = %5.2f\tN = %5.2f\n”, M,N);
} /* End of main() */
/* Function swap – to interchanges teh contents of two items*/
void swap(float *ptr1, float *ptr2 )
{
float temp;
temp=*ptr1;
*ptr1=*ptr2;
*ptr2=temp;
} /* End of Function */
/* —————————————-
Output
Enter the values of M and N
32 29
Before Swapping:M = 32.00 N = 29.00
After Swapping:M = 29.00 N = 32.00
——————————————*/
Not Satisfied ? Just search & get the result
Related posts:
- C program to read N names, store them in the form of an array and sort them in alphabetical order. Output the give names and the sorted names in two columns side by side with suitable heading
- C program to read in four integer numbers into an array and find the average of largest two of the given numbers without sorting the array. The program should output the given four numbers and the average with suitable headings.
- C program to reverse a given integer number and check whether it is a palindrome. Output the given numbers with suitable message
- C program to sort given N elements using SELECTION sort method using functions a) To find maximum of elements b) To swap two elements
- C program to accept N numbers sorted in ascending order and to search for a given number using binary search. Report success or failure in the form of suitable messages
