-
The first one can't say you're at fault, your n goes from 1 to 3 to 5....This way your n is always odd, so you're actually looking for 1+3+5....But the meaning of the actual question is to ask you to judge whether the following n is odd or not.
I'll give you the full answers to both questions.
#include
void main()
int n=1,sum=0;
while(n<=100&&n%2!=0)//n%2!=0 means that n is not divisible by 2.
sum=sum+n;
n++;Only add 1 at a time
printf("sum=%d",sum);
--Question 2.
#include
void main()
int year;
year=2000;
printf("Leap years between 2000 and 2500 are:");
while(year<=2500){
printf("%d",year);
year++;
-
The first question is basically correct, but the variable can be of type int, which is the following line:
double n,sum;
Can be modified to:
int n,sum;
The second key is how to determine a leap year, and the procedure is as follows:
#include
main(){
int i;
for (i=2000;i<=2500;i++)printf("%8d",i);
-
Changed it for you.
#include
#include
int main()
int n,sum;
sum=0;
n=1; while(n<=100)
sum=sum+n;
n=n+2;
printf("sum:%d",sum);
return 0;
--Question 2. #include
#include
int main()
unsigned int n;
n=2000;
for(n=2000;n<=2500;n=n+4)if((n%100==0)&&n%400!=0))n=n+4;
printf("%d",n);
-
!than ||High priority, so ||Finally counted. and y=1,||Whatever it is on the left, the end result is 1
The array name is a constant and is not allowed to be changed.
b becomes 9, then a++, and a becomes 2Then judge b-->0, the condition is not true, the cycle ends, and then b--the latter -- works, and b becomes 8
Needless to say, b, c, d, e, f
It points to the 2nd character of zhang, so the output.
hang&a[1][10] points to wang, and if it is &a[0][10], it points to li
-
Question 1 Question 2 [int(m 10)]%10
Question 3 a>=10&&a<=15||a<=0Question 4 8
Question 5 -3
Question 6, Question 7 D
Question 8 I don't know.
Question 9 1, 1
Question 10 A Question 11 0
Question 12 0
Question 13: I don't know.
Question 14 -63
-
Tell you, if you understand the book, you don't have to worry about what questions you do in the future, let alone passing the grade, if you tell you the answer now, you still won't necessarily do the questions in the future.
-
。The comma operator is the value of the last expression taken, as the value of the entire expression2(m-m/100)/10
a&&a>=10||a<=0
-
Child.. Do your homework or do it yourself.
-
First of all, the question is not to understand, if the mouse A1 B1 becomes a big old mouse in the first week, and the second week gives birth to the little mouse A2 B2, will the third week A1 B1 give birth to A3 B3? Or in the fourth week, a1 b1 gives birth to mice a3 b3, and a2 b2 gives birth to a4 b4??
-
1. Enter 12 data into the integer two-dimensional array b[3][4], calculate and output the sum of all positive numbers and all negative numbers in the array.
2. Young singers participate in the Song Grand Prix, and 10 judges will score them, and try to program the average score of the contestant (remove the highest score and the lowest score).
Analysis: The core of this question is sorting. The 10 scores scored by the judges are arranged in increasing (or descending) order using an array to calculate the average score of the numbers in the array except for the first and last scores.
3. Let the two-dimensional array b[5][4] have saddle points, that is, the value of the b[i][j] element is the smallest in the ith row and the largest in the jth column, try to write a program to find out all the saddle points and output their subscript values. It is also possible that there is no hereditary lead.
4. Enter a number from the keyboard, and then in an integer one-dimensional array a[20], use the half-fold search method to find out the value of the first element in the array with the number of mountain reeds. If the number is not in the array, print "no found".
5. Program and print the following graphics:
6. There is a telegram, which has been translated and decoded according to the following rules:
a→z a→z
b→y b→y
c→x c→x
That is, the first letter becomes the 26th letter, and the ith letter becomes the (26-i+1) letter. Non-alphabetic characters remain unchanged. Write a program that translates the password into the original language and outputs the password and the original language.
-
The b option should be selected, if in the definition statement double a,b; After that, since the variables a and b have already been defined correctly, the expression A = b + is correct.
-
Only c is right, a problem, numbers are stored in binary in computing, limited by binary, many numbers can not be stored exactly, can only store approximate values, such as 1 3.
b, after the statement, b is not assigned an initial value, and the content in b is a random number, resulting in a=b+xx meaningless.
d, the same as b, depending on the compiler and whether it is a global or local variable, is generally considered to be random and does not automatically initialize.
It should be 0It should be a remainder operation.
Let's write the basic things by yourself, and type all the exercises and example questions in the textbook. It's not enough to just read a book without touching the keyboard, and if you don't have a programming foundation, it's useless to understand the textbook, and some small details still have to be adjusted by yourself to feel it. After getting started, find a book on data structures and read it. >>>More
Some of the relationships are syntactic and similar: the C language is closer to the underlying C++ is an extension of C, and the mechanism of the class is added; C is a step further than C++ is Microsoft's. The language in which .net is adopted. >>>More
It's called the [batch] program, in fact, don't think that the program you mentioned above to deal with garbage is really powerful, it's amazing, when you have learned DOS, that program can be said to be a very simple thing; >>>More
Anything has a future only if it learns the apex! In particular, you must learn the language!!