Sep 24, 2019

C++ Function Example

c++ function example program
c++ function program example
Problem:
 Write a C program that accepts two integer values between 25 to 75 and return 1 if there is a common digit in both numbers otherwise 0 .

Program:
#include<stdio.h>
#include<conio.h>
int check (int a, int b)
{
int c,d,r,f;
c=a%10;
d=a/10;
program that split the digit in c++
logical operator example
e=b%10;
f=b/10;
if( c==d || c==e || c==f || d==e || d===f || e==f )
return 1;
else
return 0;
}
void main ( )
{
int a,b,r;
printf(" enter two integer number");\
scanf("%d",&a);
scanf("%d",&b);
if ((a>25 && a<=75) && (b>25 && b<=75))
r= check (a,b);
printf(" the return value is %d ",r);
getch( );
}
 In above program there are two function first use function is user defined function named as check, this type function write is function deceleration. The second is main function from this function at line 6 the instruction is used to call the function.

what is logical operator. See detail


0 comments:

Post a Comment

Please do not enter any spam link in the comment box