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
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
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:
- Re-scan downloaded files using your personal virus checker before using it.
- 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
Terms of Agreement:
By using this code, you agree to the following terms...
- 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.
- 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.
- You may link to this code from another website, but ONLY if it is not wrapped in a frame.
- You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
Report Bad Submission
Other User Comments
There are no comments on this submission.
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular code, please
click here instead.)
To post feedback, first please login.