c program for eulers theoram..
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
float i,f,j,n;
float s=1;
clrscr();
printf("Enter the num\n");
scanf("\n%f",&n);
for(i=1;i<=n;i++)
{
f=1;
for(j=1;j<=i;j++)
{
f=f*j;
}
s=s+1/f;
}
printf("\n%f\n",s);
getch();
}
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
float i,f,j,n;
float s=1;
clrscr();
printf("Enter the num\n");
scanf("\n%f",&n);
for(i=1;i<=n;i++)
{
f=1;
for(j=1;j<=i;j++)
{
f=f*j;
}
s=s+1/f;
}
printf("\n%f\n",s);
getch();
}
No comments:
Post a Comment