#include <stdio.h>
long factorial(int n) {
long result = 1;
for (int i = 1; i <= n; ++i)
result *= i;
return result;
}
int main ()
{
double n=0;
int i;
for (i=0; i<=32; i++) {
n=(1.0/factorial(i))+n;
}
printf("%.32f\n", n);
}
//2.71828182845904553488480814849027
Chat with our AI personalities
try this---> http://c-pgms.blogspot.com/2008/08/program-to-find-meanmedianand-mode_22.html
Yes, do write, or if you're too lazy to your homework, use google.
int matrix[][]; // the matrix to find the max in int max = matrix[0][0]; int r,c; for(r = 0; r < 3; ++r) { for(c = 0; c < 3; ++c) { if(matrix[r][c] > max) { max = matrix[r][c]; } } } // max is now the maximum number in matrix
see the program
program to find maximum of two numbers using pointers