| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 378 人关注过本帖
标题:Turbo C 数组方面,请大家赐教
只看楼主 加入收藏
liu800519
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2010-10-16
结帖率:100%
收藏
 问题点数:0 回复次数:1 
Turbo C 数组方面,请大家赐教
二、下列程序的功能是:生成并输出下列矩阵

请改正程序(proc2.c)中的错误或在横线处填上适当的内容并把横线删除,使它能得出正确结果。

注意:不要更改已给程序的结构,不得增行或删行。



          1 2  3  4  5
          6  7  8  9 10
         11 12 13 14 15
         16 17 18 19 20
         21 22 23 24 25
====================
main()
{int i,j,m,a[5][5];
m=1;
for (i=0;i<5;i++)
for (j=0;j<5;j++)
{
------------------
m++}
for (i=0;i<5;i++)
{for (j=1;j<5;j++)
printf("%3d",a[i][j]);
printf("\n");}
}
====================
三、请编写一个程序:把100-200之间的能被3、5、7同时整除的数输出

注意:部分源程序(proc3.c)已给出,
      请勿改动已给出的源程序,仅在/*******/与/*******/之间填入你编写地若干语句。

=====================
#include "stdio.h"
main()
{int i,n;
FILE *p;
if ((p=fopen("file1.txt","w"))==NULL)
{printf("this file can not open\n");
 exit(0);
   }
/************************************/


/***********************************/
{printf("%4d",i);
n=i;}
printf("\n");
fprintf(p,"%d",n);
fclose(p);
}
=====================
四、请编写一个函数fff,它的功能是:求出200以内所有素数之和。

注意:部分源程序(proc4.c)已给出,
      请勿改动主函数main()和已给出的源程序,仅在fff函数中的花括号内填入你编写地若干语句。
========================
#include "math.h"
#include "stdio.h"
 int fff(int a,int b)
{


}
main()
{int a,b,sum;
FILE *p;
if ((p=fopen("file2.txt","w"))==NULL)
{printf("this file can not open\n");
 exit(0);
     }
a=2;
b=200;
sum=fff(a,b);
printf("%d\n",sum);
fprintf(p,"%d\n",sum);
fclose(p);
 }
========================
搜索更多相关主题的帖子: Turbo 数组 
2010-10-16 13:38
liu800519
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2010-10-16
收藏
得分:0 
大家帮帮忙吧,我憋了一天了,还是不会,总是不对
2010-10-16 14:17
快速回复:Turbo C 数组方面,请大家赐教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016719 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved