bobod
02-28-2010, 02:32 PM
I got a question in C# i cant solve -
A)
Make an Boolean action X(int x,int y)
Input - the action recieves (number(x),digit(y)
exit - action returns True if y is in x else False
static bool X(int x,int y)
{
int temp=0;
while (x != 0)
{
temp = x % 10;
x = x / 10;
if ( temp == y)
return true;
}
return false;
}
B) Write a program that PRINTS the number of diffrent digits from each other(Example: 24462 has 3 diffrent digits) Use Action A)
My question is How the **** do i use Action A to do this **** cause Action A is Boolean!!!
Please help
A)
Make an Boolean action X(int x,int y)
Input - the action recieves (number(x),digit(y)
exit - action returns True if y is in x else False
static bool X(int x,int y)
{
int temp=0;
while (x != 0)
{
temp = x % 10;
x = x / 10;
if ( temp == y)
return true;
}
return false;
}
B) Write a program that PRINTS the number of diffrent digits from each other(Example: 24462 has 3 diffrent digits) Use Action A)
My question is How the **** do i use Action A to do this **** cause Action A is Boolean!!!
Please help