#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
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
In a C program that calculates the factorial of a number using a function, the program typically prompts the user for an integer input. The function then recursively or iteratively computes the factorial by multiplying the number by the factorial of the number minus one until it reaches one. For example, if the user inputs 5, the program outputs 120, as 5! = 5 × 4 × 3 × 2 × 1. The final result is displayed on the screen.
see the program
find the program in c-pgms.blogspot.com
Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11
For first find an example program.
find the area of abc a[2,3] c[6,0]
try this---> http://c-pgms.blogspot.com/2008/08/program-to-find-meanmedianand-mode_22.html
Oh, well, simply: max = (a + b + c * 2 + abs(a - b) + abs(a + b - c * 2 + abs(a - b))) / 4;
Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?
find median of n observation in c program
Yes, do write, or if you're too lazy to your homework, use google.
write a c++ program to convert binary number to decimal number by using while statement
largestNum = 0; for ( i = 0; i < 10 ; i++) { if ( currentNum[i] > largestNum) largestNum = currentNum[i]; }
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