⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arregloyvalormaximo.cpp

📁 Topics Practices: Programming and Numerical Methods Practice 1: Introduction to C Practice 2
💻 CPP
字号:
//Informa el maximo valor de la regla. 
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
      int n,i,max;
      int imax;
      printf("Ingrese la cantidad de n elementos \n");
      scanf("%d", &n);
      int a[n];
      printf("Ingrese %d numeros enteros\n", n);
      for(i=0; i<n; ++i)
      scanf("%d", &a[i]);  //Hasta aca tenemos el arreglo con n elementos...
      max=a[0];
      imax=0;
      for(i=1; i<n; ++i)
      if(a[i]>max) //Empiezo a comparar los elementos del arreglo
{      max=a[i]; 
      imax=i;
}
      printf("El valor maximo es %d \n", max);
      printf("se encuentra en la posicion %d\n",imax);
      printf("Precione cualquier tecla para terminar");
      getch();
}
         

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -