Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8373719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:45:01+00:00 2026-06-09T14:45:01+00:00

I need to call a program from cmd using an array of numbers(mandatory) and

  • 0

I need to call a program from cmd using an array of numbers(mandatory) and an int time(optional). I have never done this so i’m a bit shaky on the details.

The path is D:\Robert\FactorialConsoleApplication\FactorialConsoleApplication\bin\Debug\FactorialConsoleApplication.exe

As you can tell, the program calculates the factorial of the numbers in the array. The int time is used as a delay in order to display the progress of the stack.

How do I call the program with parameters?
Thanks in advance!

P.S. Here is some of the code

class Program
{
    public static void Progress(ProgressEventArgs e)
    {
        int result = e.getPartialResult;
        int stack_value = e.getValue ;
        double max = System.Convert.ToDouble(numbers[j]);
        System.Convert.ToDouble(stack_value);
        double percent = (stack_value / max) * 100;

        Console.CursorLeft = 18;
        Console.Write(result + " ");
        Console.CursorLeft = 46;
        Console.Write(System.Convert.ToInt32(percent) + "%      ");

    }
    public static void Calculate(int number, int time=0)
    {

        Factorial Fact = new Factorial();
        Fact.Progression += new Factorial.ProgressEventHandler(Progress);
        Console.Write("\n" + "Partial results : ");
        Console.CursorLeft = 35;
        Console.Write("Progress : ");         
        int Result = Fact.CalculateFactorial(number, time);
        Console.WriteLine(" ");
        Console.WriteLine("The factorial of " + number + " is : " + Result);


        Console.ReadLine();
    }

    static int j;
    static int[] numbers;


    public static void Main(string[] args)
    {
        int i=0;
        bool ok = false;
        string line = string.Empty;
        numbers = new int[10];
        Console.Write("Please insert wait time (0,1 or 2) : ");
        int time = int.Parse(Console.ReadLine()) * 1000;
        Console.Write("Please insert a number : ");
        do
        {
            line = Console.ReadLine();
            if (line != "")
            {
                i++;
                numbers[i] = int.Parse(line);


            }
            else
            {
                ok = true;
            }
        }
        while (ok == false);
        for (j = 1; j <= i; j++)
        {

            Calculate(numbers[j],time);
        }

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:45:02+00:00Added an answer on June 9, 2026 at 2:45 pm

    Ok, so here is the solution.

    I used an args parser like this :

    static int extra;
        public static void Main(string[] args)
        {
    
            foreach (string s in args)
            {
                extra = int.Parse(s);
    
    
                Calculate(extra);
            }
         }
    

    And I changed :double max = System.Convert.ToDouble(numbers[j]);
    to :double max = System.Convert.ToDouble(extra);

    To call it I open cmd in the directory where the exe is and I type :

    Program.exe 3 4 5

    It will calculate the factorials of 3, 4 and 5 respectively

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a third party DLL i need to call from my C# program.
I need to call from my code for some other program . And I
I need to call some methods in Wininet.dll from a Java program. I can
I need to call a C++ member function from a C program. I created
I need to call an external program from Delphi 2006 code with a long
I need to call a function from another program. If the other program were
I have a computational terminal program that I need to interact with using a
How to call program from web. Just like yahoo messenger ymsgr:sendIM?myyahooid I need solution
I have a C# dll that I need to call from unmanaged C++. The
I have a custom JPanel and sometimes throughout my program, I need to call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.