#include<iostream.h>
#include<conio.h>
int addition(int a,int b=10,int c=20,int d=30);
void main()
{
                int p=5,q=6,r=7,s=8;
                clrscr();
                cout<<"\nWith Four Parameter :- "<<addition(p,q,r,s);
                cout<<"\nWith Three Parameter :- "<<addition(p,q,r);
                cout<<"\nWith Two Parameter :- "<<addition(p,q);
                cout<<"\nWith One Parameter :- "<<addition(p);
//            cout<<"\nWith Zero Parameter :- "<<addition();               //Error
                getch();
}
int addition(int a,int b,int c,int d)
{
                return (a+b+c+d);
}

75.PNG

Advertisements