In C#, how can I recreate this into a Windows form Application instead of a console application? Please show a photo of the display and show the code that you used, thank you! Problem: Write a function Seperate( number ) that separates an integer number (ranging from 0 to 99999) into its digits. For example, if the number is 42329, the function finds 4, 2, 3, 2, 9. If the number is 323, the function finds 0, 0, 3, 2, 3. (Hint: use modulus and integer division operations.)
Question:
In C#, how can I recreate this into a Windows form Application instead of a console application? Please show a photo of the display and show the code that you used, thank you!
Problem: Write a function Seperate( number ) that separates an integer number (ranging from 0 to 99999) into its digits. For example, if the number is 42329, the function finds 4, 2, 3, 2, 9. If the number is 323, the function finds 0, 0, 3, 2, 3. (Hint: use modulus and integer division operations.)
Code:
using System;
public class RecExercise4
{
static void Main()
{
Console.Write("Input any number (ranging from 0 to 99999) : ");
int num = Convert.ToInt32(Console.ReadLine());
Console.Write(" The digits in the number are : ");
separateDigits(num);
}
static void separateDigits(int n)
{
int i = 4;
int[] arr;
arr = new int[5];
while (i>-1)
{
arr[i] = n%10;
n = n/10;
i--;
}
foreach(int j in arr)
Console.Write(" " + j);
}
}

Step by step
Solved in 2 steps with 1 images









