-
#include
using namespace std;
int main()
float j=-1;
float sum=0;
for(int i=1;i<=10;i++)j=j*(-1);
sum=sum+j/i;
cout<<"1-1/2+1/3-1/4……+1 9-1 10 and yes"I guess your problem must be a mistake in the use of division.
int int: quotient of integers.
int%int: integer remainder.
float int, float float, int float: get the result of the float type.
-
The password is 5 digits, which is the least common multiple of and 104.
-
Hello for your inquiry; Ok, here are some C language practice questions for your reference:1Enter two integers a and b, and output their sum, difference, product, quotient, and remainder.
2.Enter a positive integer n and output all odd numbers from 1 to n. 3.
Enter a positive integer n to determine if it is prime (a prime number is a number that is only divisible by 1 and itself). 4.Enter a positive integer n and output its factorial (n!).
5.Enter a string to count the number of uppercase letters, lowercase letters, digits, and other characters.
6.Enter a string that converts all lowercase letters into uppercase letters. 7.
Enter a string to determine if it's a palindrome string (a palindrome string is a string that is read both forward and backwards). 8.Enter a string of characters sorted in lexicographic order from smallest to largest.
9.Enter an array of elements sorted from smallest to largest. 10.
Enter a positive integer n to output the first n terms of the Fibonacci sequence (the Fibonacci number refers to the division of the good one.
-
Answer: A Error correction.
int p;
scanf("%d",&p);
int *p,a;
p=&a;scanf("%d",p);
Both of the above are fine.
Analysis: The compiler does not initialize the "local variable", the global variable is initialized to 0
Answer A cannot be used because it is not initialized before using the pointer variable p.
2.Answer B Error correction.
int *s,k;
s=&k;*s=100;
Pass a, both are pointers that are not initialized before use.
3.Answer C is correct.
4.Answer d is incorrect.
s=p;is wrong.
This is because s is an integer pointer and p is a character pointer. Two variables with different pointer types cannot be assigned.
I hope mine was helpful to you and it was a pleasure to learn and discuss C programming with you.
-
The pointers of A and B are null pointers, and D cannot be implicitly converted in C++, and an error will be reported.
-
CD is fine, AB is used without allocating memory.
-
Only C should be correct, and the last 2 lines of D have memory out-of-bounds issues.
It's not very hard that the tail node next points to null. >>>More
The introductory course of MCU C language programming is not difficult, it is not easy to say, and the first thing to understand is to understand what these two things are when learning MCU C language? The introductory programming of single-chip microcomputer is mainly to learn C language, followed by circuit and programming language. >>>More
2. 1, True 2, False (there is only one program) 3, False (not necessarily) 4, True. >>>More
for(i=3;i<=ihuffsize[n-1];i++)uint_8s[0]=0;
uint_8s[1]=uint_8[p]; >>>More
It should be 0It should be a remainder operation.