23 Topics

Member Avatar for
Member Avatar for bdl365

I am having difficulties writing the program. the program should ask user for a positive integer and print a factorial table. for example - Give me a positive integer: 5 1! = 1 = 1 2! = 2 x 1 = 2 3! = 3 x 2 x 1 = …

Member Avatar for Muhammad_331
0
2K
Member Avatar for vegaseat
Member Avatar for Aya Safi

import java.util.Scanner; import java.lang.Math; public class Exercise1 { public static void main(String[] args){ double x,sum = 0.0 ; Scanner scan = new Scanner(System.in); System.out.print("Enter the number : "); x = scan.nextInt(); for(double i=0;i<=(x+1);i++){ Math.pow(x, i); fact(i); double y = (Math.pow(x, i)/fact(i)); sum += y; } System.out.println("The e^"+x+" for "+x+" is …

Member Avatar for jwenting
0
212
Member Avatar for tasmotors
Member Avatar for Reverend Jim
0
89
Member Avatar for vegaseat

This snippet allows you to find the number of ordered permutations of items taken from a population of known size. It uses the well know algorithm with factorials. For very large populations you may want to use an approximation of factorials.

3
3K
Member Avatar for Atlanta15Braves

I need a program that will return an integers factorial, but only when the number entered is between 0 and 20. I have the code to disregard anything below 0 and above 20, but something with my math and/or syntax is off and I dont fully comprehend how to fix …

Member Avatar for JamesCherrill
0
262
Member Avatar for gacusana.aljan

how to create a window with label and button above the label. can you codes this label : MAIN MENU BUTTON : RECURSION BUTTON: EXIT PLEASE HELP ME ! ITS ALL ABOUT RECURSION

Member Avatar for stultuske
0
100
Member Avatar for lili22

[B]Hello .. im a business student with a vb.net course .. donno why we're being taught vb but that's that .. any ways could anyone help me solve this problem: Develop an application which reads two integers n1 and n2 from the user via two textboxes and displays in a …

Member Avatar for Reverend Jim
0
356
Member Avatar for xiangzhuang

Hey guys, I have this HW for school for Java but I just can't seem to figure it out. I know I have to use a for loop for it but I just can't seem to figure out everything else. Thanks :D public int factorial(int n) { }

Member Avatar for JamesCherrill
0
412
Member Avatar for Raim

So I'm making a simple calculator program on the Windows Form Application of C++. Nevertheless, I'm stuck on the exponents, factorial, and square root part. In my System32 Console calculator, these were the codes I use for the exponent, factorial, and respectively, while I just used the sqrt function of …

Member Avatar for Raim
0
387
Member Avatar for Xufyan

here why should we have to write [B]c=1[/B] ?? i couldn't understand the logic of writing c=1 :s... please just explain the logic [CODE]void main(void) { int a,b,c=1; a=5; for ( b=a; b>0; b--) { c*=b; } printf ("The Factorial of %d is %d\n",a,c); getch(); }[/CODE]

Member Avatar for muktigeek
0
611
Member Avatar for rayden150

Hello good people of YA programming section I really need some help here, I made a function to find me the multiplication of the factorial of any number that I input but if I put say 100 it only gives back 0, when it should give 5050, maybe its the …

Member Avatar for WaltP
0
254
Member Avatar for lil_miss_choc

I'm working through an exercise to create a short program to calculate E using the series 1 + 1/1! +1/2! + 1/3! + ... The summation has to stop when value of a term is less than a value entered by the user. The code I have to produce the …

Member Avatar for lil_miss_choc
0
223
Member Avatar for naseerhaider

I'm brand new to C++ ,I've written following code for finding a number's factorial,Can you please let me know how to write it more elegantly ? [CODE]#include <iostream> using namespace std ; main () { int num = 0 ; // declaring variables double result = 1 ; long int …

Member Avatar for naseerhaider
0
173
Member Avatar for Momerath

Generating permutations of a sequence is a problem that is commonly asked. It's fairly easy to do if you know how many items will be used beforehand, but a generic method to do so would be better. The snippet will do a lazy generation of the permutations (the next one …

Member Avatar for ddanbe
3
1K
Member Avatar for mrar85

Hello, i'm a newbie with c++.. all help and explanation are welcome..my problem is, i try to make a factorial program in c++ . Here is my code: [CODE]#include <iostream> using namespace std; int main() { int a,b,fact=1; char key; do { cout<<"\nPlease enter a positive integer : "; cin>>b; …

Member Avatar for mrar85
0
2K
Member Avatar for jwebb

Hello, I'm trying to create a program to calculate the factorial of variable int input. I am using xcode, and it's giving me an error saying "factorial was not declared in this scope" on the line within the else statement. I have found other programs on the internet, but I …

Member Avatar for jwebb
0
658
Member Avatar for farhanafzal

Write a C program to find and print the product of factorial of numbers from N to M. Can anyone please give me an idea, how to solve this Question ? Thank you.

Member Avatar for nbaztec
0
221
Member Avatar for Ajantis

Hey folks :) I was writing some code today, and I wrote a function for computing factorials without use of recursion. What do you think about this one? [CODE]int factorial(N) { int r; r = 0; while (N > 0) { r *= (n-1); n--; } return r; }[/CODE]

Member Avatar for jwenting
0
168
Member Avatar for aay

I know this has been asked before, but none of the threads I found helped me much. I am a beginner at C++ programming and need help figuring out why this doesn't work. [B]Question[/B]: e^x can be approximated by sum 1 + x + x^2/2! + x^3/3 + ... + …

Member Avatar for WaltP
0
3K
Member Avatar for Xufyan

Can anyone explain whats wrong with this program why this is not working. [CODE] void main(void) { long a,b=1; clrscr (); printf ("Enter number to calculate its factorial:"); scanf ("%ld",&a); if (a=0,1) printf ("You entered 0 or 1"); else for (a=a;a>0;a--) { b*=a; } printf ("Answer is %ld",b); getch (); …

Member Avatar for Xufyan
0
1K
Member Avatar for furqankhyraj

[CODE] #include<stdio.h> #include<conio.h> void main() { int n,f; f=1; printf("Enter the number:\n"); scanf("%d",&n); while(n>0) { printf("%d",n); f=f*n; n--; } printf("The factorial of the integer is:%d",f); getch(); } [/CODE]

Member Avatar for WaltP
0
147
Member Avatar for hopeful man

hi everybody, i was reading some lessons regarding Recursion, and then i came across a question that i couldn't answer it ,, therefore i need your help in this question, the question is : Write a program to accept an integer value and find the factorial from 10 to 1 …

Member Avatar for Grn Xtrm
0
86

The End.