Click here to Skip to main content
15,916,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: passing parameters to Cdialog Constructer defination Pin
ForNow30-Oct-17 13:19
ForNow30-Oct-17 13:19 
QuestionRe: passing parameters to Cdialog Constructer defination Pin
David Crow31-Oct-17 2:48
David Crow31-Oct-17 2:48 
AnswerRe: passing parameters to Cdialog Constructer defination Pin
ForNow31-Oct-17 2:58
ForNow31-Oct-17 2:58 
GeneralRe: passing parameters to Cdialog Pin
Sascha Lefèvre30-Oct-17 14:03
professionalSascha Lefèvre30-Oct-17 14:03 
GeneralRe: passing parameters to Cdialog Pin
Rick York30-Oct-17 15:26
mveRick York30-Oct-17 15:26 
GeneralRe: passing parameters to Cdialog Pin
Richard MacCutchan30-Oct-17 22:45
mveRichard MacCutchan30-Oct-17 22:45 
GeneralRe: passing parameters to Cdialog Pin
Jochen Arndt30-Oct-17 23:06
professionalJochen Arndt30-Oct-17 23:06 
Questionpascals triangle using user-define function use. Not working ! Pin
Tarun Jha28-Oct-17 8:50
Tarun Jha28-Oct-17 8:50 
it works fine until the 3 column but in the 4th column it doesn't.


C++
#include <conio.h>
#include <stdio.h>

long int factorial(int num);

int main(){

	int row, col_1, col_2, i, j;
	long int k;

	printf("Enter the number of rows: \n");
	scanf("%d", &row);

	col_1 = row-2;
	
	for(i=0; i<=row-1; i++){

		for(j=0; j<=col_1; j++){
			printf(" ");
		}
		col_1--;

		for(col_2=0; col_2<=i; col_2++){

			k = factorial(i)/( factorial(i-col_2) * factorial(col_2) ) ;
			printf(" %ld ", k);
		}
		printf("\n");
	}

	return 0;
}

long int factorial(int num){

	int total, i;

	if(num==0 || num==1){
		total=1;

	}else{
		
		total = 1;
		for(i=1; i<=num; i++){

			total = total*num;
			num--;
		}
	}

    return total;
}


modified 28-Oct-17 15:42pm.

AnswerRe: pascals triangle using user-define function use. Not working ! Pin
Victor Nijegorodov28-Oct-17 9:12
Victor Nijegorodov28-Oct-17 9:12 
AnswerRe: pascals triangle using user-define function use. Not working ! Pin
Richard MacCutchan28-Oct-17 22:03
mveRichard MacCutchan28-Oct-17 22:03 
AnswerRe: pascals triangle using user-define function use. Not working ! Pin
CPallini29-Oct-17 22:59
mveCPallini29-Oct-17 22:59 
GeneralRe: pascals triangle using user-define function use. Not working ! Pin
Tarun Jha31-Oct-17 10:19
Tarun Jha31-Oct-17 10:19 
GeneralRe: pascals triangle using user-define function use. Not working ! Pin
CPallini31-Oct-17 23:30
mveCPallini31-Oct-17 23:30 
QuestionData Structure issue Pin
patriotaki28-Oct-17 2:33
patriotaki28-Oct-17 2:33 
AnswerRe: Data Structure issue Pin
leon de boer28-Oct-17 6:23
leon de boer28-Oct-17 6:23 
GeneralRe: Data Structure issue Pin
harold aptroot28-Oct-17 6:52
harold aptroot28-Oct-17 6:52 
GeneralRe: Data Structure issue Pin
leon de boer28-Oct-17 6:58
leon de boer28-Oct-17 6:58 
GeneralRe: Data Structure issue Pin
harold aptroot28-Oct-17 7:42
harold aptroot28-Oct-17 7:42 
GeneralRe: Data Structure issue Pin
leon de boer28-Oct-17 23:10
leon de boer28-Oct-17 23:10 
GeneralRe: Data Structure issue Pin
harold aptroot29-Oct-17 0:52
harold aptroot29-Oct-17 0:52 
GeneralRe: Data Structure issue Pin
leon de boer29-Oct-17 7:45
leon de boer29-Oct-17 7:45 
GeneralRe: Data Structure issue Pin
harold aptroot29-Oct-17 9:38
harold aptroot29-Oct-17 9:38 
GeneralRe: Data Structure issue Pin
leon de boer29-Oct-17 17:12
leon de boer29-Oct-17 17:12 
GeneralRe: Data Structure issue Pin
harold aptroot29-Oct-17 22:37
harold aptroot29-Oct-17 22:37 
GeneralRe: Data Structure issue Pin
leon de boer30-Oct-17 4:25
leon de boer30-Oct-17 4:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.