By using our mini forum, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy

Q: Task - Program for printing company information in C#

+3 votes

A company has name, address, phone number, fax number, web site and manager.

The manager has first name, last name, age and a phone number.

Write a program that reads the information about a company and its manager and prints it back on the console.



Company name:

Sky Painters and Decorators

Company address:

43 Burbery Ave, London

Phone number:

+44 768 5806

Fax number:

+44 768 5806

Web site:

Manager first name:


Manager last name:


Manager age:


Manager phone:

+44 7268 5896


Sky Painters and Decorators

Address: 43 Burbery Ave, London

Tel. +44 768 5806

Fax: +44 768 5806

Web site:

Manager: Lewis Anderson (age: 45, tel. +44 7268 5896)



asked in C# category by user richard8502

2 Answers

+1 vote
Best answer

Here is the output:

printingcompany info in C# and visual studio console application


and the code:

using System;

class PrintCompanyInformation
    static void Main()
        Console.Write("Please write your company name: ");
        string companyName = Console.ReadLine();

        Console.Write("Please write your company address: ");
        string companyAddress = Console.ReadLine();

        Console.Write("Please write your phone number: ");
        long phoneNumber = long.Parse(Console.ReadLine());

        Console.Write("Please write your fax number: ");
        long faxNumber = long.Parse(Console.ReadLine());

        Console.Write("Please write your company web-site: ");
        string webSite = Console.ReadLine();

        Console.Write("Please write Manager's first name: ");
        string firstName = Console.ReadLine();

        Console.Write("Please write Manager's last name: ");
        string lastName = Console.ReadLine();

        Console.Write("Please write Manager's age: ");
        byte ageManager = byte.Parse(Console.ReadLine());

        Console.Write("Please write Manager's phone: ");
        long phoneManager = long.Parse(Console.ReadLine());

        Console.WriteLine("{0}", companyName);
        Console.WriteLine("Adress: {0}", companyAddress);
        Console.WriteLine("Tel. {0}", phoneNumber);
        Console.WriteLine("Fax. {0}", faxNumber);
        Console.WriteLine("Web-site: {0}", webSite);
        Console.WriteLine("Manager: {0}" + " " + "{1}" + " " + "(age: {2}," + " " + "tel.: {3})", firstName, lastName, ageManager, phoneManager);
answered by user john7
edited by user golearnweb
+1 vote

Regarding john7's solution:

When you are using integer data type for the phone and for the fax - it cannot show the + sign in fron of the number - so in my opinion - you must use string for them - this way the + sign will be visible when printing

answered by user ak47seo