a program to print the first 7 positive integers and their factorials.

#include "stdio.h"

int main()
{
int i;
int factorial = 1;

for(i = 1; i <= 7; i = i + 1)
{
factorial = factorial * i;
printf("%d %d\n", i, factorial);
}

return 0;
}

No comments:

Post a Comment