选择题:
1-5: A D C B B
6-10: D C B C B
#include<myhead.h>
int main(int argc, char *acgv[])
{
int i;
int sum1=0;
int sum2=0;
int sum=0;
for(i=1; i<101; i++)
{
if(i%2 == 0)
{
sum1+=(i*i*i);
}
else if(i%2 == 1)
{
sum2+=(i*i);
}
}
sum=sum1+sum2;
printf("1-100中奇数的平方和为:%d, 偶数的立方和为:%d\n", sum2, sum1);
printf("1-100中奇数的平方与偶数的立方的和为:%d\n", sum);
return 0;
}
#include <myhead.h>
int main(int argc, const char *argv[])
{
char* buffer = (char*)malloc(1024);//手动申请空间
if (buffer == NULL) {
printf("空间申请失败\n");
return 1;
}
int start = 512;
for(int i=0;i<1024;i++){
*(buffer+i)=start+i;//把512到1536存到申请的空间
}
for(int i=1;i<1024;i+=32){
for(int j=0;j<32;j++){
printf("%d ",*(buffer+i+j));
}
putchar(10);
}
free(buffer);
return 0;
}