Article Directory
1. Multiple choice questions
1-5 CAAB
6-10 DCBBB
11-15 ISSUE
16-20 CDBAA
Two, programming questions
- Write a function to find 1+2+3+4+…+n, and input the value of n in the main program and output the result
#include<stdio.h>
int fun(int n){
int sum=0;
for(int i=1;i<=n;i++){
sum+=i;
}
return sum;
}
int main()
{
int n;
int sum=0;
scanf("%d",&n);
sum=fun(n);
printf("%d",sum);
return 0;
}
- The remaining programming questions will be posted separately
If you have any questions, you can leave a message in the comment area