首页 > 其他 > 详细

练习2

时间:2019-11-16 21:00:05      阅读:68      评论:0      收藏:0      [点我收藏+]
#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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!