C# Program to Generate Random Numbers? - Amit Notes

Latest

Oct 23, 2021

C# Program to Generate Random Numbers?

C# Program to Generate Random Numbers?
Amit-notes

C# Program to Generate Random Numbers?

Code: -

using System;

class amitnotes

{

    static void Main()

    {

        Console.WriteLine("Some Random Numbers which might be generated are :");

        for (int i = 1; i < 10; i++)

        {

            Randfunc();

        }

    }

    static Random r = new Random();

    static void Randfunc()

    {

        int n = r.Next();

        Console.WriteLine(n);

        Console.ReadLine();

    }

}

 

Runtime Test Cases: -

Some Random Numbers which might be generated are :

1234567

8754352

9864930

8352048

1920472

2846104

7649207

4928756

9261746

-------------------------------END------------------------------------------

Read more about C# :-

1.Write a C# Sharp program to find whether a given year is a leap year or not.

2.Write a program in C# Sharp to check whether a number is a palindrome or not.

3.C# Program to Perform Celsius to Fahrenheit Conversion.

4.C# Program to Reverse a String with Predefined Function.

5.C# Program to Sort a String using Predefined Function

No comments:

Post a Comment

If you have any doubts, Please let me know