求10個數中的最大值
#include <stdio.h>
int main()
{
int i;
int max;
int ar[10];
for(i=0;i<10;i++)
{
scanf("%d\n",&ar[i]);
}
max = ar[0];
for(i=0;i<10;i++)
{
if(max < ar[i])
max = ar[i];
}
printf("max=%d\n",max);
return 0;
}
相關推薦
二維陣列求10個數的最大值
#include<stdio.h> int main() { int a[3][4]={{11,12,13,15},{9,7,8},{22,33,44}};//定義陣列及初始化 int i,j; int row=0,colum=0,max=
C#--輸入10個數存入陣列中,求這10個數的最大值、最小值和平均值。
輸入10個數存入陣列中,求這10個數的最大值、最小值和平均值。 using System; using System.Collections.Generic; using System.Linq; u
php 寫程序求三個數的最大值
定義函數 pyw max函數 https pst com amp 定義 http 最簡單的調用PHP自帶的max函數即可:echo max(1,2,3,4,5);如果要自定義函數的話:function test($a,$b,$c){ return $a > $b
C++求兩個數的最大值
eof sizeof ios int sig turn c++ a + b -a //不使用if,:?等推斷語句。求兩個數字中最大的那個數字。 #include<iostream> using namespace std; int main(
求數組中最大值
ack 函數 run 記錄 類型 () 字符數 on() span /* 所有c語言代碼,都是在LoadRunner中運行; */ Action(){ int a[]={12,34,565,23,24,667,89,98};//定義一個int數組; int len;
C語言實現求兩個數的最大值,C語言實現雞兔同籠問題
實驗三:輸入兩個數求最大者 #include<stdio.h> int main()//主函式 { int max(int x,int y); int a,b,c; printf("請輸入a:\n"); scanf("%d",&a); pr
編寫一求兩個數的最大值的函式Max, 要求用模板實現對任意資料型別資料都可應用該函式求取結果,
/*編寫一求兩個數的最大值的函式Max, 要求用模板實現對任意資料型別資料都可應用該函式求取結果, 在main()函式中分別用整型、實型、字元型資料進行測試。 */ #include<iostream> #include<string.h> us
資訊學奧林匹克競賽-C語言輸出3個數中最大值
輸出3個數中最大值 #include <stdio.h> int main() { int a,b,c; scanf("%d %d %d",&a,&b,&c);
求兩個數的最大值(用函式指標變數呼叫函式)
#include<stdio.h> int max(int a,int b) { if(a>b) return a; else return b; } int main() { int x,y,z; scanf("%d%d",&
求三個數的最大值(利用三目運算子)
//求三個資料中的最大值 public class OperatorTest {public static void main(String[] args) {//定義三個變數int a = 20 ;int b = 50 ;int c = 30 ;//使用中間第三方變數實現
行內函數,求三個數的最大值
#include<iostream> using namespace std; inline int max(int,int,int); int main() { int i=10,j=20,k=30,m; m=max(i,j,k); cout<&l
C語言 n個數中最大值
int main(){ int n,a,max,i; scanf("%d",&n); scanf("%d",&max); for(i=1;i<n;i++) { scanf("%d",&a); if(a>max)max
for編寫10個數找最大值
import java.util.Scanner; public class Test02{ public static void main(String[] args){ Scanner in
JS求兩個數的最大值
<!DOCTYPE html> <html> <head> <title>第一題</title> <meta charset="utf-8"> </head> <!--
求數組中最大值和次大值
http 運行 else if ++ pre int mage 技術分享 分享圖片 一維數組,找出其中最大的數和第二大的數。 #include<stdio.h> void main() { int a[]={1,23,45,6,34,2,67,345,6
求10個數中的最大值
#include <stdio.h> int main() { int i; int max; int ar[10]; for(i=0;i<10;i++) { scanf("%d\n",&ar[i]); } max = ar[
c# 求10個數中的最大最小值
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program
求10 個數中的最大值
1、這個題目的做法都在下面程式碼的註釋中,大家可以一步一步來體會 #include<stdio.h> #include<windows.h> int main() {int i = 0;int max = 0;//定義一個maxint arr[10]
求一個數組中最大值與最小值
div return urn 技術 code include 一個 最小值 array #include <stdio.h> int main() { int array[10]={100,1,40,29,45,22,98,2,83,75};
C語言:求10 個整數中最大值
求10 個整數中最大值思路:求10 個整數中最大值,可以利用陣列來完成對10個數的儲存,再用迴圈語句和條件語句來判斷數的大小, 把最大值賦值給最大值變數max,然後輸出最大值。 程式碼如下: #include<stdio.h> int main() { int i,max;