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 8377603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:42:49+00:00 2026-06-09T15:42:49+00:00

I need to output the value of d using the same Console.WriteLine . But

  • 0

I need to output the value of d using the same Console.WriteLine. But i am only getting Result not the value of d in output. In what way i can achieve this?

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            int b;
            Console.WriteLine("Please Enter the first Digit");
            a = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Please Enter the Second Digit");
            b = Convert.ToInt32(Console.ReadLine());
            int d = a + b;
            Console.WriteLine("Result",(d));

        }
    }
}
  • 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-09T15:42:51+00:00Added an answer on June 9, 2026 at 3:42 pm

    Use:

    Console.WriteLine("Result {0}", d);
    

    You are using this overload.

    UPDATE

    If you look at the link above, you can read how it works. In short, first you specify the formatting, where {0} references the first value of the param object-array, {1} references the second value of the param object-array, etc. After the format, you give the objects to use.

    So in your case, you need a single value, which means two arguments, a format, and a value. Hence “Result {0}” with d, which will become (when for example d=10) “Result 10”.

    Note: also removed the unnecessary parenthesis.

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

Sidebar

Related Questions

I need a macro which helps to output the given parameter's name and value.
I need to output some text as bash script, but in a script. I
Am using few variables to load csv file value into raw destination, and same
if suppose the same tags will be repeated but for that tag value will
Everything is relative of course, but compared to simply executing the same SQL using
I have several nodes with same Name='UPC' and I need to find the value
I need to output the lines of a file where the first column's values
I need to output a file in the format of a Word document from
I need to output the days of the week in a JSP. Clearly I
It has suddenly happened that I need to output a couple of strings in

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.