Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: [C#Help]

  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    [C#Help]

    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

    Code:
    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
    Last edited by bobod; 02-28-2010 at 03:50 PM. Reason: Code

  • #2
    New Coder
    Join Date
    Feb 2010
    Posts
    29
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Code:
    for (i=0;i<9;i++)
    if (X(input,i)==TRUE)
      countDigits++;

  • Users who have thanked ffmast for this post:

    bobod (02-28-2010)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •