/*DATO UN NUMERO, CALCOLARE LA RDICE QUADRATS SOLO NEL CASO SIA POSITIVO.PER RISOLVERE QUESTO ESERCIZIO E NECESARIO INCLUDERE
math.h, CHE COMPRENDE LA FUNZIONE sqrt PER IL CALCOLO DELLLA RADICE QUADRATA DI UN NUMERO E CHE RESTITUISCE UN VALORE DI TIPO double
*/
#include "stdafx.h"
#include <math.h>
#include <windows.h
int _tmain(int argc, _TCHAR* argv[])
{
printf("digita un numero per calcolare la radice quadrata : ");
float numero;
scanf_s("%f", &numero);
int resultato;
if (numero > 0)
{
resultato = sqrt(numero);
printf("la radice quadrata de %g e = %i\n", numero, resultato);
}
else printf("non si puo fare la radice quadrata di un numero negativo ");
system("pause");
return 0;
}
<<< LISTA
Nessun commento:
Posta un commento