please make a factorial number that the output is like this:

Enter a number:5

5!=1*2*3*4*5
5!=120

likewise

Enter a number:6
6!=1*2*3*4*5*6
6!=720

please..help.

using for loop statement only.

please do not use #include<iostream.h>...

use this
example:
#include <stdio.h>
#include <conio.h>
........etc.

please...help me...

Recommended Answers

All 8 Replies

Post your attempt to solve the problem.

please make a factorial number that the output is like this:

Enter a number:5

5!=1*2*3*4*5
5!=120

likewise

Enter a number:6
6!=1*2*3*4*5*6
6!=720

please..help.

using for loop statement only.

please do not use #include<iostream.h>...

use this
example:
#include <stdio.h>
#include <conio.h>
........etc.

please...help me...

#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,f;
clrscr();
f=1;
printf("enter no");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
f=f*i;
}
printf("fac=%d",f);
getch();
}
commented: Don't post complete solutions to homework problems. -5
commented: 1st- you didn't read any of the rules. 2nd-You didn't read the previous post. 3rd-We DO NOT give away code. 4th-Format your code -2

here what you want.
the code is developed with tc++ ver.3.0

#include<stdio.h>
#include<conio.h>
void main()
{
	clrscr();

	int i,j,n,d,k;
	printf( "\n Enter the no.:  " );
	scanf( "%d",&n );
	printf( "\n\n %d! = ",n );

	for( i = 0,k = j = n; i < 5; i++ )
	{
		if( k == 1 )
			printf( "%d ", k );
		else
			printf( "%d * ", k );

		k = k - 1;

		if( k > 0 )
			n = n * k;

	}

	printf( "\n\n %d! = %d",j,n );

	getch();
}

i think it solves your problem. Have a good day!

commented: Don't post complete solutions to homework problems. Did you not read the post immediately above this one?? +0
commented: Not only that but the code is non-standard and not worthy of teaching. -2

please make a factorial number that the output is like this:

Enter a number:5

5!=1*2*3*4*5
5!=120

likewise

Enter a number:6
6!=1*2*3*4*5*6
6!=720

please..help.

using for loop statement only.

please do not use #include<iostream.h>...

use this
example:
#include <stdio.h>
#include <conio.h>
........etc.

please...help me...

#include<stdio.h>#include<conio.h>void main(){int i,n,f;clrscr();f=1;printf("enter no");scanf("%d",&n);for(i=1;i<=n;i++){f=f*i;}printf("fac=%d",f);getch();}#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,f;
clrscr();
f=1;
printf("enter no");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
f=f*i;
}
printf("fac=%d",f);
getch();
}
commented: OMG that's worse than your first post. -5
commented: This is even worse code than the previous poster. It uses the same bad techniques and adds even more. -2

@micjan : Congrats you got the code !!! I certainly wish the two smart people above get you everything you want in your life ... because with this attitude you are not gonna learn or earn anything...!!!

commented: I like it! +19

@micjan : Congrats you got the code !!! I certainly wish the two smart people above get you everything you want in your life

Especially since both of them answered with terrible non-standard code, which makes the code dangerous to people's understanding of good code practices. Please ignore the code given.

commented: They were horrid excuses for programs weren't they :) +19

please make a factorial number that the output is like this:

Enter a number:5

5!=1*2*3*4*5
5!=120

likewise

Enter a number:6
6!=1*2*3*4*5*6
6!=720

please..help.

using for loop statement only.

please do not use #include<iostream.h>...

use this
example:
#include <stdio.h>
#include <conio.h>
........etc.

please...help me...

#include<stdio.h>
main()
{
int a, fact;
printf("\nEnter any number: ");
scanf ("%d", &a);
fact=rec (a);
printf("\nFactorial Value = %d", fact);
}

rec (int x)
{
int f;
if (x==1)
return (1);
else
f=x*rec(x-1);
return (f);
}
commented: Why didn't you read the previous code posts? We DO NOT give away code. And format your code -2

You can ignore that code also. Be sure you write your own code micjan and don't even bother with code that has no formatting, improper function definitions, bad headers, etc.

And to rajendra.parmar, skwatamkar, and abc@ -- please refrain from doing other people's homework for them. They learn nothing, and you are posting code that will probably not get an A because of the above.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.