发布网友 发布时间:2024-10-23 23:12
共2个回答
热心网友 时间:2024-10-29 21:25
#include<stdio.h> main() { int i,a[10],max; for(i=0;i<10;i++) scanf("%d",&a[i]); max=a[0]; for(i=1;i<10;i++) if(max<a[i]) max=a[i]; printf("最大值为%d\n",max); } 后面的A B瓶子看不大懂- -热心网友 时间:2024-10-29 21:20
#include "stdlib.h" #include <windows.h> int main() { int szNumber[10] = {0}; int nMax = 0; printf("请输入10个数:"); for (int i = 0; i < 10; i++) { scanf("%d", &szNumber[i]); if (nMax < szNumber[i]) { nMax = szNumber[i]; } } printf("最大的数为:%d\r\n", nMax); //////////////////////////////////////////////////////////////////// // 交换两个数 int nNumberOne = 5; int nNumberTwo = 3; // 方法一: nNumberOne ^= nNumberTwo; nNumberTwo ^= nNumberOne; nNumberOne ^= nNumberTwo; // 方法二: int nNumber = nNumberOne; nNumberOne = nNumberTwo; nNumberTwo = nNumber; return 0; }