#include<stdio.h>
#include<stdlib.h>
int main(){
int i = 1;
int count = 0;
for (i = 1; i <= 100; i ++){
if (i % 10 == 9){
count++;
}
if (i / 10== 9){
count++;
}
}
printf("%d\n", count);
system("pause");
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main(){
int i = 100;
double sum = 0;
double tmp = 1;
int flag = 1;
for (i = 1; i < =100; i++){
tmp* = flag1.0 / i;
flat *= -1;
sum += tmp;
}
print("%1f", sum);
system("pause");
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int main(){
int a[5]={1, 2, 3, 4,5};
int b[5]={7, 8, 9, 4,6};
int i;
int tmp;
for (i = 0; i < 5; i++){
tmp = a[i];
a[i]= b[i];
b[i]= tmp;
}
for (i = 0; i < 5; i++){
printf("%d", a[i]);
}
putchar(‘/n‘);
for (i = 0; i < 5; i++){
tmp = b[i];
b[i] = a[i];
a[i] = tmp;
}
for (i = 0; i < 5; i++){
printf("%d", b[i]);
}
putchar(‘/n‘);
system("pause");
return 0;
}
练习2
原文:https://www.cnblogs.com/yuzhenghan/p/11873088.html