Thursday, September 5, 2019

C program to find factorial if given number

#include <stdio.h>
int main()
{
int n,fact,i=1,c;
again:
fact=1;

printf("enter n \n");
scanf("%d",&n);


while (i<=n)
{
fact=fact*i;
i++;
}
printf("%d\n",fact);
printf("enter 1 to exit else any int.\n");
    scanf("%d",&c);
    if(c!=1)
    goto again;
    else return 0;

}

No comments:

Implement stsStr Leetcode solution

  28.   Implement strStr() Easy Implement  strStr() . Given two strings  needle  and  haystack , return the index of the first occurrence of...