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

  • Home
  • SEARCH
  • 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 8428033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:56:34+00:00 2026-06-10T04:56:34+00:00

The user inputs their age, and I have to return that age and then

  • 0

The user inputs their age, and I have to return that age and then half of the age number in a decimal value, as well as displaying an inputted salary in dollar amounts.

The sample variable I was given included:

    float y;

So here’s an example of how I used it in the code I wrote:

    using System;

    public class Profile
    {
        static void Main(string[] args)
        {
            int x;
            float y = 2.0f;
            var result = x / y;

            Console.Write("Please enter your age:");
            x = Covert.ToInt32(Console.ReadLine());

            Console.WriteLine("Your age is {0}, and half your age is {1}."
            , x, result);

            Console.ReadKey();
        }
    }

But if I type a number like “18”, it says “Your age is 18, and half of your age is 9.” I can’t get it to give me something like “9.0” or anything.

I was also shown that my application should state the salary with a decimal and commas (e.g. $250,000.00) but it only shows “$250000.” An example of what I used is:

    decimal z;

    Console.Write("Please enter your salary");
    z = Convert.ToDecimal(Console.ReadLine());

    Console.WriteLine("Your salary is {0}.", z);

    Console.ReadKey();

Am I just not supposed to see a decimal in the results?

  • 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-10T04:56:36+00:00Added an answer on June 10, 2026 at 4:56 am

    use the string format options:

    Console.WriteLine("Your age is {0}, and half your age is {1:00.00}."
            , x, result);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that registers users based on their user input. This uses
When a user inputs a value in a certain column then this value should
I have an array of user inputs ($atts) as key=>value pairs. Some of the
I have a textbox where a user inputs a number, like: 105.14 When I
I have a form where the user inputs Chinese/Japanese characters and then I compare
I currently have a form that requests the user's email, cell phone number, and
I have a windows form application where a user inputs their name (First and
I want to have two input with one button for user to enter their
When validating user inputs in an application that is to be run across multiple
I'm writing a program where the user inputs names and then ages. The program

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.