Sunday, March 18, 2018
Friday, March 16, 2018
Factorial Of A Number Using Recursion
/* Factorial of a Number Using Recursion */
#include <stdio.h>
long int multiplyNumbers(int n);
int main()
{
int n;
printf("Enter a positive integer: ");
scanf("%d", &n);
printf("Factorial of %d = %ld", n, multiplyNumbers(n));
return 0;
}
long int multiplyNumbers(int n)
{
if (n >= 1)
return n*multiplyNumbers(n-1);
else
return 1;
}
Output:-
Factorial Of A Number Using Recursion |
Thursday, March 15, 2018
Program To Print Full Pyramid Using *
/*Program to print full pyramid using * */
#include <stdio.h>
int main()
{
int i, space, rows, k=0;
printf("Enter number of rows: ");
scanf("%d",&rows);
for(i=1; i<=rows; ++i, k=0)
{
for(space=1; space<=rows-i; ++space)
{
printf(" ");
}
while(k != 2*i-1)
{
printf("* ");
++k;
}
printf("\n");
}
return 0;
}
Output:-
Program To Print Full Pyramid Using * |
Subscribe to:
Posts (Atom)
Life Articles And News:
Life Articles And News:
-
/*Program to print full pyramid using * */ #include <stdio.h> int main() { int i, space, rows, k=0; ...
-
One of the most commonly treated infertility-related conditions in the United States is diminished ovarian reserve, also known as low-eg...