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

📄 practica2_14.cpp

📁 Topics Practices: Programming and Numerical Methods Practice 1: Introduction to C Practice 2
💻 CPP
字号:
/*PRACTICA 2 EJERCICIO 14
Escribir una funci髇 que tome como par醡etro un n鷐ero real y que calcule el 
m骴ulo del n鷐ero ingresado. Utilizar esta funci髇 para escribir un programa que 
le pida al usuario tres n鷐eros y que muestre por pantalla el promedio de los 
m骴ulos de estos n鷐eros.*/

#include<stdio.h>
#include<conio.h>
#include<math.h>
float f (float n)
{
    if (n<0)
    return -n;
    else
    return n;
}
main()
{
     float a, b ,c ,k;
     printf("ingrese un numero real: ");
     scanf("%f", &a); 
     printf("ingrese un numero real: ");
     scanf("%f", &b);
     printf("ingrese un numero real: ");
     scanf("%f", &c);
     k=(f(a) + f(b) + f(c))/3;
     printf("el promedio es %f\n", k);
     printf("PRESIONE CUALQUIER TECLA PARA TERMINAR!!!!!");
     getch();
}

⌨️ 快捷键说明

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