C program to swapping the two numbers using function concept.

 

C program
C PROGRAM 


C program to swapping the two numbers using function concept

#include<stdio.h>
#include<conio.h>
void swap(int,int);
void main()
{
  int x,y;
  clrscr();
  printf("enter the values of x and y:\n");
  scanf("%d%d",&x,&y);
  printf("\nbefore swapping values are:x=%d,y=%d",x,y);
  swap(x,y);
  getch();
  }
  void swap(int m,int n)
  {
    int temp;
    temp=m;
    m=n;
    n=temp;
    printf("\nafter swapping values are:m=%d,n=%d",m,n);
    getch();
   }

OUTPUT :

enter the values of x and y:
3

before swapping values are:x=2,y=3
after swapping values are:m=3,n=2
Process finished.

Comments

Popular posts from this blog

Write a program to calculate a students result based on two examinations, 1 sports event, and 3 activities conducted. The weightage of activities= 30%, sports= 20% , and examinations= 50%.

Determine the intensity of shear of an oil having viscosity= 1 poise. The oil is used for lubricating the clearance between a shaft of diameter 10 cm and its journal bearing. The clearance is 1.5mm and the shaft rotates at 150 r.p.m.