Search for notes by fellow students, in your own course and all over the country.
Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.
Title: C sharp
Description: An C sharp question and their solution for those who looking forward to learn programming.
Description: An C sharp question and their solution for those who looking forward to learn programming.
Document Preview
Extracts from the notes are below, to see the PDF you'll receive please use the links above
4
...
b) The if/else selection structure executes one action when a condition is true and
another
action when a condition is false
...
d) Specifying the order in which statements are to be executed in a computer program is
called program control
...
f) Keywords are reserved by C# to implement various features, such as the language’s
control structures
...
h) The increment operator (++) and decrement operator (--) increment and decrement a
variable’s value by one
...
4
...
If false, explain why
...
b)True
...
d)True
...
f)True
...
h)True
...
3 Write four different C# statements that each add 1 to integer variable x
and store the result in x
...
2)x += 1;
...
4)x++;
...
4 Write C# statements to accomplish each of the following:
a) Assign the sum of x and y to z then increment x by 1 after the calculation
...
a) z = x++ + y;
b) Test if the value of the variable count is greater than 10
...
b) if ( count > 10 )
Console
...
Use only one
statement
...
Write
this statement two different ways
...
5 Write a C# statement to accomplish each of the following tasks:
a) Declare variables sum and x to be of type int
...
*) x = 1;
c) Assign 0 to variable sum
...
*) sum += x; or sum = sum + x;
e) Print "The sum is : " followed by the value of variable sum
...
WriteLine( "The sum is: " + sum ); or
Console
...
6
Combine the statements that you wrote in Exercise 4
...
Use the while structure to
loop through the calculation
and increment statements
...
int sum, x;
x = 1;
sum = 0;
while ( x <= 10 )
{
sum += x++;
}
Console
...
7 Determine the values of each variable after the calculation is performed
...
a) product *= x++;
b) quotient /= ++x;
a) product = 25, x = 6;
b) quotient = 0, x = 6;
4
...
WriteLine( "Woman" );
else;
Console
...
Correction: Add closing right brace after the statement ++c;
...
The second output statement
will always be executed
...
4
...
Therefore, if the
loopcontinuation
condition ( z >= 0 ) is true, an infinite loop is created
...
Title: C sharp
Description: An C sharp question and their solution for those who looking forward to learn programming.
Description: An C sharp question and their solution for those who looking forward to learn programming.