#include<stdio.h>
#define _CRT_SECURE_NO_WARNINGS 1
int Add(int a, int b) { //函数定义要在main函数前
int c = a + b;
return c; //最后返回值
}
int main()
{
int num1 = 0;
int num2 = 0;
scanf("%d %d", &num1, &num2);
int sum = Add(num1, num2); //函数名(参数1,参数2...)
printf("%d\n", sum);
int arr1[9] = { 15,56,23,89,70,60,88 }; //数组的数不够,剩余用0来补
int i = 0;
while (i<=8) {
printf("%d\n", arr1[i]);
i++;
}
return 0;
}
初识函数&&数组遍历
最新推荐文章于 2024-03-02 23:02:10 发布