Results 1 to 2 of 2

Thread: Need help with a code in C LANGUAGE [C Programming]

  1. #1

    Joined
    Jan 2014
    Posts
    320
    Userbars
    6
    Thanks
    353
    Thanked
    145/99
    DL/UL
    50/0
    Mentioned
    46 times
    Time Online
    8d 20h 39m
    Avg. Time Online
    3m

    Need help with a code in C LANGUAGE [C Programming]

    Q) Write a program to take an input array of 10 elements from user using recursion.

    Can anyone please write the code and also explain it to me????
    I pray that whoever reads this, God heals whatever is hurting you.

  2. #2
    Nyu's Avatar
    Joined
    Jun 2016
    Posts
    595
    Pronouns
    She
    Userbars
    29
    Thanks
    740
    Thanked
    933/252
    DL/UL
    32/0
    Mentioned
    99 times
    Time Online
    56d 11h 1m
    Avg. Time Online
    28m
    Quote Originally Posted by bluevitriol View Post
    Q) Write a program to take an input array of 10 elements from user using recursion.

    Can anyone please write the code and also explain it to me????
    I use C#, but maybe there's something similar in C...
    Code:
    string[] myArray=new string[10];//declare array and size, can be int if that's what youll ask for
    for (int i =0; i<10; i++){// start at 0, until i is lower than 10, add one each time
        Console.WriteLine("Enter value "+(i+1)+":  ");//Write so the user knows they have to enter something.
        string input = Console.ReadLine();// ask for input
        myArray[i]=input;// add input to array
    }
    This is written in C#, i did it really fast, so no idea if i messed up somewhere, but its so you understand.
    Im sure you can do the same in C.

  3. The Following User Says Thank You to Nyu For This Useful Post:

    bluevitriol (10-30-2018)

Posting Permissions

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