Write a program of function with no parameter and but return value


 

/* Write a program of function with no parameter and but return value. */

#include<iostream.h>

#include<conio.h>

void main()

{

int a,b,c;

int sum(int,int);

clrscr();

cout<<“enter number a=”;

cin>>a;

cout<<“enter number b=”;

cin>>b;

c=sum(a,b);

cout<<”c=”<<c;

getch();

}

int sum(int x,int y)

{

int z;

z=x+y;

return(z);

}

output:

enter number a=6

enter number b=5

c=11

Related Posts

Comments are closed.