Programación en lenguaje C, tema: Suma de fracciones
#include lt; stdio.hgt;
void main()
{
int n;
scanf("d", amp;n);
while (n lt;=0)
{
printf("nlt;=0, Vuelva a ingresar n: ");
scanf("d", amp; n);
} int nAdd = 1.0;
if (n2 = = 0 amp; n !=1)
{
nAdd = 2.0
} float fCount = 0.0f; p > for(int i=nAdd; ilt; =n; i =2)
{
float nf = 1.0/i
fCount = nf; ;
} if (nAdd == 1)
{
printf("1/1 1/3 ... 1/n = f\n " , fCount);
}
else
{
printf("1/2 1/4 ... 1/ n = f\n", fCount);
}
}