hi everyone :), i wanted to create a little program with makes the divisions of the elements of a table i wanted to create a loop which will indicate if there's a number in the table then we should c "the division cannot be made", if not we will get the result,the problem is it doesnt work, u may try it n it wont, i know u will say wht is the utility of such stuff, well im just new to C so im tryin with basics,o_O enough talkin here's my source code

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 4

void main()
{
                //variables

	double table[n]={0};
	long no=1,i;
	double x=0,d;

                //program
	for (i=0; i<n; i++)
	{
	printf("enter the number %d", i);
	scanf("%f", &table[i]);
	}
	printf("gr8\n");
	printf("%f", table[0]/table[1]);//this is just to c if it works
	for (i=0; i<n; i++)
	{
		do
		{
			if(x==0)
			no=0;
			x=table[i+1];
		}
		while (x!=0);
	}
	if (no==0)
		printf("the division cannot be made");
	else
		d=table[0]/table[1]/table[2]/table[3];
		printf("the division is %f", d);



	system("pause");
}

plz help me solving this, i spent almost a week thinking about it
thank u for ur help

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define n 4

void main()
{
//variables

float table[n];
int no=1,i;
float x=0;
float d;
clrscr();
//program
for (i=0; i<n; i++)
{
printf("Enter the number %d : ", i);
scanf("%f", &table[i]);
}
for (i=0; i<n; i++)
{
if(x==0 && i!=0)
no=0;
else
x=table[i];
}
if (no==0)
printf("\nThe division cannot be made");
else
{
d=table[0];
for(i=1;i<n;i++)
d=d/table[i];
printf("\nThe division is %f ", d);
}
getch();
}

It will Help you !

Comments
Badly formatted code is rarely a help

Try using periods every once in a while.

Maybe english isn't her primary language?

Maybe english isn't her primary language?

Regardless, it is still a good suggestion.

It will Help you !

Why this is bad help:
1) No CODE tags
2) No formatting, code is very difficult to read. See this
3) #include<conio.h> -- not portable. Do not use.
4) void main() -- see this
5) clrscr(); -- only 1 compiler defines this function - do not use
6) getch(); -- not portable. Use standard C instead, like getchar() barbiegirl,
Please explain what you want in detail. Your explanation is lacking in data necessary to understand your problem. Did you read the post titled Read Me: Read This Before Posting?

I have given this program only to develop your logic ,it is not a standard form .

And where in your original post did you explain that? So how is the person you're trying to help going to know your program is only a logic lesson? And with all the problems, how is he going to know what is good and what is bad since he's new to programming?

IOW, don't help people by showing bad code because it's confusing and does more harm than good. Show an algorithm rather than code if you can't post good stuff. For one, they can learn more from a good algorithm. And, secondly, they can't turn your work to get a good grade. They have to still write it themselves.

Well......... I know its a mistake but i want her to study these things , every time u cannot write what is going on and what is not , and if a person use 1% of his/her brain he/she can know what does that mean ............

This article has been dead for over six months. Start a new discussion instead.