?? practica2_14.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 + -