
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A simple c program that calculates the factorial of a given number using a for loop. The user is prompted to enter a number, and the program calculates and displays the factorial of that number.
Typology: Exercises
1 / 1
This page cannot be seen from the preview
Don't miss anything!
#include<stdio.h> #include<conio.h> void main() { long int a,b=1,i; clrscr(); printf ("Please enter a number\n"); scanf ("%ld",&a); for (i=a; i>=1; i=i-1) printf("The factorial of the given number is: %ld",b); getch(); } { b=i*b; }^ Factorial^1 docsity.com