Featured post

-Write C program to find even and odd number using macro

-Write C program to find even and odd number using macro #include<stdio.h> #define number(n)((n%2==0)?1:0) int main() { int num; printf("enter any number"); scanf("%d",&num); if(number(num)) printf("number is even"); else printf("number is odd"); return 0; } ***************************Output*********************** amr@amrj-virtual-machine:~$ gccevenodd.c amr@samr-virtual-machine:~$ ./a.out enter any number 2 number is evensmj@amr-virtual-machine:~$

Write a c++ program to find the Function overloading example in c++(Addition, Subtraction,Multiplication).

A C++ Program To calculate the example of function overloading:

#include<iostream>
using namespace std;
int fun();
int fun(int a,int b);
int fun(int a);

int fun()
{
int a,b;
cout<<" Enter the three values:";
cin>>a>>b;
cout<<"\n Sum is"<<a+b;
return 0;
}
int fun(int a,int b)
{
cout<<"\n Subtraction  is:"<<a-b;
return 0;
}
int fun(int a)
{
cout<<"\n Multiplication is same values:"<<a*a;
return 0;
}
int main()
{
fun();
fun(10,5);
fun(4);
return 0;


Out Put:-

 Enter the three values:5
6

 Sum is11
 Substraction is:5
 Multipliaction is same values:16
--------------------------------
Process exited after 3.722 seconds with return value 0
Press any key to continue . . .

Comments

Popular posts from this blog

-Write C program to find even and odd number using macro

BCA (SCIENCE) JAVA PRACTICAL SLIPS PAGES.(JAVA) UNIVERSITY OF PUNE

How to OCR Text Extraction in Flutter Using Google ML Kit