By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.


P: 2
I need help with c program in combinatorics! I has lost file, and i forget what did i write last time, but i try to write some, so following is my code:
/* Program to calculate mutiplication for triple of integer that sum up to a total_length */

#include <stdio.h>
#define TOTAL_LENGTH 100

int main(void)
float x,y,z,total_length;
float orig_x,orig_y,orig_z;
int cnt=0,i,j,k,n;
int status;

printf("This program to calculate mutiplication for triple of integer that sum up to a total_length");

do {
printf("Enter an number x:");
status = scanf("%f",&x);
printf("Enter an number y:");
status = scanf("%f",&y);
printf("Enter an number z:");
status = scanf("%f",&z);

if(i*x+j*y+k*z==total_length) {
printf("\n Calculating the program\n\n");
Sep 20 '06 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 5K+
P: 8,916
What happens when you compile/run it?

You seem to detect the answer but not output the values of the variables concerned
Sep 20 '06 #2

P: 2
Actually Last time it runs, but seem vaid. But I can't remember what other staff I write. It is a combitorirics. mautiple of three defferent numbers to sum up to a total length. for eg: 1 integer times 1 number+1 integer times another number+1 integer times another defference integer.
Sep 21 '06 #3

Expert Mod 5K+
P: 8,916
The only error I can see is that you don't seem to assign a value to n and that when you have found a solution you do not print out the values of the variables involved for that solution.
Sep 21 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.