Write a program in c using for loop , calculate and print the product ( p = 1 * 2 * 3 * 4 * 5 * 6 * 7 )
#include< #include< #include< main() { int i, p; p = 1; for (i=1; i<8; i=i+1) { p = p * i; } printf("The product is %d\n", p); return(0); } |
---|
Output:
The product is 5040
0 comments:
Post a Comment