Write a C program to swapping the two values using a function with argument and return values.

C program

C PROGRAM


Write a C program to swapping the two values using a function with argument and return values 


#include <stdio.h>
#include<conio.h>
int add(int,int);
void main()
{
  int a,b,c;
  clrscr();
  printf("enter the values of a and b \n");
  scanf("%d%d",&a,&b);
  c=add(a,b);
  printf("the result is %d",c);
  getch();
  }
  int add(int m,int n)
  {
    int result;
    result=m+n;
    return(result);
   }

OUTPUT :


enter the values of a and b 
2
3
the result is 5
Process finished


infinitynotes00

No comments:

Post a Comment




Copyright Ⓒ 2022 | Mechpedia | All Right Reserved.