编写一个函数 求出int数组中最大的数
2012-05-24 13:27
295 查看
#include "stdAfx.h" #include "ctype.h" #include "stdlib.h" int main(void) { void sum_(int a[],int x); int a[5]={4,7,1,8,9}; sum_(a,5); system("pause"); return 0; } void sum_(int a[],int x) { int i,sum; sum=a[0]; for(i=0;i<x;i++) if(sum<a[i]) sum=a[i]; printf("%d\n",sum); }
相关文章推荐
- 编写一个函数,返回一个int数组中存储的最大数值,并在一个简单的程序中测试这个函数。(有缺陷)
- 编写函数int stat(int a[],int n,int c[][2])。a指向的数组中保存了由n个1位整数组成的数列(n为偶数)。函数从前至后依次将a数组中每两个相邻元素拼成一个不超过2位的
- 编写一个能将给定非负整数数组中的数字排列成最大数字的函数
- 编写一个函数,它从一个字符串中提取一个子字符串。函数原型如下: Int substr(char dst[], char src[],int start, int len) {} 目标是:从src数组
- C语言实现 编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数。
- C语言 编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数。
- 编写一个函数link_sort(),用链表将数组int a[] = {49, 38, 65, 97, 76, 13, 27} 按升序排序
- 编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数。
- 编写一个函数 返回数组中最大值与最小值的差值
- 编写一个计算一维数组中所有整数的最大公约数的函数
- 有一个整数数组,请编写一个函数,找出索引m和n,只要将m和n之间的元素排好序,整个数组就是有序的。注意:n-m应该越小越好,也就是说,找出符合条件的最短序列。 给定一个int数组A和数组的大小n,请
- 请编写一个函数jsValue(int m,int k,int xx[]),该函数的功能是:将大于整数m且紧靠m的k个素数存入数组xx传回
- 【C语言】编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数。(辗转相除法和常规求法)
- 二、 编写函数int stat(int a[],int n,int c[][2])。a指向的数组中保存了由n个1位整数组成的数列(n为偶数)。函数从前至后依次将a数组中每两个相邻元素拼成一个不超过2位
- 【嵌入式系统学习记录】练习:编写一个函数,求字符数组的前n个字符中最大字符的地址并返回该地址,字符数组和n作为函数的参数;
- C 编写求一个数组中最大值的函数
- Linux_C练习:编写一个函数,求字符数组的前n个字符中最大字符的地址并返回该地址,字符数组和n作为函数的参数;
- 编写函数int stat(int a[],int n,int c[][2])。a指向的数组中保存了由n个1位整数组成的数列(n为偶数)。函数从前至后依次将a数组中每两个相邻元素拼成一个不超过2位
- 编写一个函数,传入a,b两个int类型的变量,返回两个值的最大公约数
- 编写函数int stat(int a[],int n,int c[][2])。a指向的数组中保存了由n个1位整数组成的数列(n为偶数)。函数从前至后依次将a数组中每两个相邻元素拼成一个不超过2位的