Important alert: (current site time 5/20/2013 11:56:32 AM EDT) Brand new: recommended reading for every programming language on the site | revamped discussion board | 7 Source Code CDs

FirstCSharpProgram

Email
 Submitted on: 5/7/2012 2:01:42 PM By: Ronald Holland Level: Beginner User Rating: Unrated Compatibility: C# Views: 856

This tutoial present seven c# examples that will help the reader get started with C#. They are: 1- helloworld.cs - Purpose: Write a message to the standard out 2- secondPgm.cs - Purpose: add two number and write to the standard out 3- thirdPgm.cs - Purpose: add two numbers, store the result in variable c, and then write the value of c out to the screen 4- fourthPgm.cs - Purpose: request two numbers from the user; a- Add the two numbers and store the result in variable sum b- Write the value of sum out to the screen c- Multiply the two numbers and store the result in variable product d- Write the value of product out to the screen e- Add the two numbers, compute the average and store the result in variable average f- Write the value of average out to the screen 5- fifthPgm.cs - Purpose: request three numbers from the user. - Add the three numbers and store the result in variable sum - Write the value of sum to the screen - Multiply the three numbers together and store the result in variable product - Write the value of product to the screen - Add the three numbers and compute the average and then store the value in the variable average 6- sixthPgm.cs - Purpose: Obtain two numbers. raise the first number to the power of the second e.g., x ^ y raise x to the y power 7- seventhPgm.cs - Purpose: Calculate the weekly pay of a worker. - Declare the variables that will be used. - Ask the user how many days worked this week. - Ask the user how many hours worked this week. - Compute the average hours worked per day. - Ask the user for their payrate. - Compute the weekly salary. - Print to screen the - workDays - workHours - weeklyPay

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

Terms of Agreement:
By using this code, you agree to the following terms...
1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3. You may link to this code from another website, but ONLY if it is not wrapped in a frame.
4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)