Declaration of Cube
Guys please help me.. Is this a right way to declare cube.?
If i Compile it.

It Says: Cube undeclared

what should i do?

Please help

\thanks in advanced

#include<stdio.h>
#include<math.h>
#include<conio.h>

main( )
{
float x,y;
while(x++<10.0)
{
printf("Enter Number:");
scanf("%d", &x);

y = cube(x);
printf("%f %f %f \n", x,pow(x,2),y);

cube(x);
}
{
float x;

float y;
y = x*x*x;
}
getch();
return (y);
}

Answers were Sorted based on User's Feedback



Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. ..

Answer / michael

you need to do
printf("Enter Number:");
scanf("%d", &x);

before entering while loop
becauser in while loop it needs to know what is x

or

float x=0

Is This Answer Correct ?    1 Yes 0 No

Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. ..

Answer / sanjay741

its so simple... 1st of all i would like to tell you that Cube(element) is not a math function... so develop a function for cude and just call it...

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C C++ Errors Interview Questions

what is the error in the following code: main() { int i=400,j; j=(i*i)/i; }

4 Answers  


loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program.

5 Answers   CMC,


how tally is useful?

2 Answers  


what is exceptions?

5 Answers   HCL, Wipro,


how to convert decimal to binary in c using while loop without using array

50 Answers   Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,






class test { int a; public: test(int b):a(b){} void show(){ cout<<a; } }; void main() { test t1; test t2(5); t1.show(); t2.show(); } }

1 Answers  


what is macro in c? Difference between single linked list & double linked list what is fifo & lifo? what is stack & queue?

2 Answers   TCS,


To generate the series 1+3+5+7+... using C program

18 Answers  


what is run time error?

7 Answers  


What are the different types of errors in C and when they occur?

4 Answers  


Write a program to accept two strings of Odd lengths. Then take all odd characters from one string and even characters from the other and concatenate and produce a string.

1 Answers  


A sample program using data structure? what is file handling?

0 Answers   TCS,


Categories