C # No basic learning programming questions !!

Source: Internet
Author: User

1. Compile a program, input three numbers from the keyboard, and use the if statement and logical expression to find the maximum number.

2. Compile a program, input three numbers from the keyboard, and use the if statement and logical expression to find the minimum number.
3. Compile a program and define a character variable. Use the if else statement to enter a character. if it is a capital letter, convert it to a lower-case letter. if it is a lower-case letter, it is converted into uppercase letters, otherwise it is not converted. Then output the result.
4. Compile a program and define three float variables x, y, and z. Input three real numbers. Sort these three variables in ascending order and then output the results.
5. A program defines a double-precision floating point number variable. Input a number from the keyboard to determine whether it is in the range of [, 1200.
1. Write a program, define three float variables, input values to them from the keyboard, then use the if else selection statement to find the minimum number among them, and finally output the result.
2. Compile a program, enter a score (0-100), and then use the if else statement to determine whether the score is excellent, good, medium, or fail.
3. Compile a program, enter a positive integer whose score is less than or equal to 100, and use the switch statement to determine the score level. 90 to 100 is divided into excellent, 80 to 89 is divided into good, 60 to 79 is divided into pass, 59 points below is fail.
4. Write a program and input ten single-precision floating-point numbers using the while LOOP statement to obtain their average values.
5. Compile a program and use the do while (while, for) loop statement to calculate PI = 4*(1-1/3 + 1/5 +... + 1/n), requires that the calculation be stopped when n> 1000.

1. Compile a program to define an integer array with 8 elements. Input 8 values and then sort the array in bubble ascending order. Then, output the elements of the array in sequence. (P95)
2. Compile a program and define an array with 10 elements. Assign the constant values {, 65,} to find the maximum and minimum values in the data set.
3. Compile a program and define an array. You must use the for statement to input 8 numbers from the keyboard and find the maximum number and maximum number of times.
4. Compile a program. The program generates 8 random numbers and outputs these 8 numbers in ascending order.
5. Compile a program, input a string, read the string using a foreach loop statement, count the number of upper-case letters, the number of lower-case letters, and the number of other characters, and finally output the result.
1. Write a program, use the while statement to nest it, and find 1! + 2! +... + 5! .
2. Compile a program and use the while LOOP statement to input five double-precision floating point numbers on the keyboard to find the sum of positive numbers and negative numbers.
3. Compile a program, input three sides of the triangle, and find its area.
4. Compile a program and use the for loop statement. If you do not need an array, enter 5 floating point numbers on the keyboard. You must find the maximum and minimum numbers.
5. Compile a program and use the for loop statement. Without arrays, input 5 real numbers, find the maximum and minimum numbers among them, and obtain the average values of these 5 real numbers.
1. Compile a program, define a string variable, enter a string, and then enter a character to search for the number of occurrences of the character in the string.
2. Compile a program and use the for statement to print an isosceles triangle in the following form. The vertex is online on the screen and the number of rows are input from the keyboard.
*******
*****
***
*
3. Compile a program and enter an integer to determine the number of digits. For example, 99 is two digits, and-100 is three digits.
4. Compile a program, input values of a, B, and c, and define a non-static method, obtain the two roots of the quadratic equation a x + B x + c = 0.
5. Compile a program and enter a positive integer to determine whether it is an integer multiple of 2 and 3. If yes, yes is output; otherwise, no is output.
1. Compile a program. There is a fruit shop owner who has bought 1888 watermelons. On the first day, he sold more than half and two others, and then he sold more than half and two others each day. Could you tell me, can this batch of watermelons be sold out in a few days?
Int x, sum = 0;
X =;
While (x> 0)
{
X = x-x/2-2;
Sum ++;
}

2. Compile a program and find the number between 1 and 6000 that can meet the requirement of "3 Division 2, 5 Division 3, and 7 Division 2. Five outputs per row are required.
3. Compile a program, enter a positive integer, count the number of zeros in each digit of this positive integer, and find the iterator in each digit.
4. Compile a program, output the number that can be divisible by 3 but not by 5 in 1 to 1000, and count the number of such records.
5. Compile a program, define a string variable str, input a string, and then enter a character or string. Use the string method IndexOf () find the number of times this character or string appears in the str string.

* 6. Compile a program, define a string variable, input a string, and check whether repeated characters appear consecutively. count the number of repeated characters. For example, xxxbayydzzz, where x is repeated three times, y is repeated twice, z is repeated three times, and a total of eight characters are repeated.
Compile a program to create an integer two-dimensional array (five columns and four columns) for three courses for five candidates, perform static initialization, enter the examinee Score data, and calculate the total score of each candidate. Then, the score of each candidate's course is output, and the total score of each candidate is also output.
Compile a program to create an integer two-dimensional array (five columns and four columns) for three courses for five candidates, perform static initialization, enter the examinee Score data, and calculate the total score of each candidate. Sort the scores in descending order, and then output the scores of each course and the total scores of each candidate.
1. Compile a program, input three numbers from the keyboard, find the maximum number, and output it.
2. Compile a program, input three numbers from the keyboard, find the minimum number, and output it.
3. Compile a program, input ten real numbers, store them into an array, and output them in ascending order using the Bubble sorting method.
4. Compile a program, define a string variable s, input a string, put the string upside down, and output the string variable s.
5. Compile a program to calculate an expense. Each Apple costs 0.8 yuan and buys two apples on the first day. Starting from the next day, the number of apples bought each day is twice that of the previous day until the number of apples bought each day exceeds 100. How much is the average daily cost?

6. Compile a program to find all the homogeneous numbers between 1 and 99. The homogeneous number is a set of numbers: it appears on the right of the number of operators. For example, 5 is the number on the Right of 25, 25 is the number on the Right of 625, and 5 and 25 are homogeneous numbers.

7. Compile a program to extract eight balls from three red balls, five white balls, and six black balls at will, which must contain white balls and output all possible solutions.

 

 

-----

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.