CrazyEngineers
  • How to add spaces in between characters in a char array without using builtin fuctions

    Harsha Swamy

    Member

    Updated: Oct 26, 2024
    Views: 1.2K

    Input- "java"

    output-" j a v a"

    That is inserting a space in between two characters in a char array

    In a char array without using any built in functions like append. if possible provide the code also

    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Anoop Kumar

    MemberMar 14, 2019

    I will give you logic

    //------------------ 
    ... 
    For  int i = 0  to inputString.Length -1 
        If i == 0
            print inputString.charAt(i)
        Else 
            Print <space>
            Print inputString.charAt(i)
        End If
    End For loop
    ... 
    //------------------ 


    Are you sure? This action cannot be undone.
    Cancel
  • Harsha Swamy

    MemberMar 14, 2019

    no bro doesn't work 

    Are you sure? This action cannot be undone.
    Cancel
  • Anoop Kumar

    MemberMar 14, 2019

    Give your code please ! 

    I don't see any issue with the logic. I created a code snippet and it works fine.

    Are you sure? This action cannot be undone.
    Cancel
  • Harsha Swamy

    MemberMar 14, 2019

    My bad it actually worked thanks Anoop....

    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register