You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
387 B
C

/* Pattern problem
x=1!+3!+5!+7!+9!+...
*/
#include <stdio.h>
#include <conio.h>
void main()
{
int i, n ;
clrscr() ;
printf("Enter n:") ;
scanf("%d", &n) ;
printf("Required Pattern is as shown:\n") ;
printf("x=1!") ;
for(i=3 ; i<=2*n-1 ; i=i+2)
printf("+%d!", i) ;
getch() ;
}
/*
Output:
Enter n:3
Required Pattern is as shown:
x=1!+3!+5!
*/