博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
实验四
阅读量:7174 次
发布时间:2019-06-29

本文共 939 字,大约阅读时间需要 3 分钟。

#include <stdio.h>

void swap(int *x,int *y)

{  int temp;

 temp=*x; 

*x=*y;

 *y=temp;

}

int main()

{  int i,j;

 int a[10];

 for(i=0;i<10;i++)

 {scanf("%d",&a[i]);}

    for(i=0;i<10;i++) 

{   for(j=0;j<10;j++)

  {    if (a[i]<a[j])  

      swap(&a[i],&a[j]);

 

}

 }

 for(i=0;i<10;i++)

  printf("%d\n",a[i]);

return 0;

}

#include <stdio.h>

 void main()

 {   

int a[3][3],i,j,m=0,n=0;

  for (i = 0; i < 3; ++i)  

{     

for (j = 0; j < 3; ++j)   

{        scanf("%d",&a[i][j]);  } 

  }

m=a[0][0]+a[1][1]+a[2][2];  

n=a[0][2]+a[1][1]+a[2][0];  

printf("%d\n%d\n",m,n);

}

#include <stdio.h>

int main()

{  int i,n=1;

 char a[1000];

 gets(a); 

for(i=0;i<1000;i++)

 {   if(a[i]==' ') 

  n++;  

 } 

printf("%d\n",n);

  return 0;

}

#include <stdio.h>

int main()

{    

 int n = 100;  

 int mark[101] = {1, 1}; 

 int c;  

 int j;

    for (c = 2; c * c <= n; c++)

 {   

 if(mark[c] != 1)  

 {           

   for(j=2; j<=n/c; j++){mark[c*j]=1;

}   

   } 

    }  for(c=2;c<=n;c++)

 {          

 if(mark[c]!=1){printf("%d\n",c);

}  

   }   

 return 0;  

}

 

转载于:https://www.cnblogs.com/p201821430019/p/10911630.html

你可能感兴趣的文章
android 获取所有SD卡目录
查看>>
A trick in loading Fixture to test django application
查看>>
经典SQL语句
查看>>
canvas 画椭圆
查看>>
NormalMap
查看>>
java中的注解(一)
查看>>
linux 02 基础命令
查看>>
表单提交中get与post的区别
查看>>
@Transactional注解
查看>>
erlang 时间处理
查看>>
Ubuntu安装pintos
查看>>
Retrofit原理学习
查看>>
hdu Dropping tests 0/1分数规划(二分求值)
查看>>
source命令
查看>>
C、C++混合编程之extern "C"
查看>>
【题解】洪水
查看>>
销傲中国式销售过程管理系统功能概述
查看>>
IDEA 学习笔记之 Java项目开发深入学习(1)
查看>>
重建二叉树 (剑指offer第六题)
查看>>
爬虫基础 pyquery 详解
查看>>