Write a program to sum of two numbers with user defined function giving value at runtime.


 

/* Write a program to sum of two numbers with user defined function giving value at runtime.*/

#include<iostream.h>

#include<conio.h>

void main()

{

int a,b;

void sum(int,int);

clrscr();

cout<<“enter  a number=”;

cin>>a;

cout<<“enter b number=”;

cin>>b;

sum(a,b);

getch();

}

void sum(int x,int y)

{

int z;

z=x+y;

cout<<“z=”<<z;

}

output:

enter a number=6

enter b number=9

z=15

Related Posts

Comments are closed.