micjan

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

using for loop statement only.

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

Ancient Dragon 5,243

Post your attempt to solve the problem.

abc@ -14

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

using for loop statement only.

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

``````#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: 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
commented: Don't post complete solutions to homework problems. -5

skwatamkar -4

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

abc@ -14

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`

using for loop statement only.

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

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

``````#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: This is even worse code than the previous poster. It uses the same bad techniques and adds even more. -2
commented: OMG that's worse than your first post. -5

csurfer 422

@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

WaltP 2,905

@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

rajendra.parmar -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

using for loop statement only.

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

``````#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

WaltP 2,905

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.