answersLogoWhite

0

Finding cube using while loop in c?

Updated: 12/14/2022
User Avatar

Wiki User

14y ago

Best Answer

int cube=1,num,i;

for(i=1;i<=3;i++){

cube*=num;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Finding cube using while loop in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is main different between do while and while?

If you want to execute a statement which is in while loop at least one time you can use do- while loop. this is why because initially first statements will be executed then condition will be checked. but in case of while first condition will be check then statements will be executed


Compare Do-While with While Statements?

A Do-While loop looks like this: do { loop body } while (condition); and a While loop looks like this: while (condition) { loop body } The main difference is that the loop body is always run once in the Do-While loop, then the condition is checked to see if the loop should keep running. In a While loop, the condition is checked first, and it will not run the loop body at all if the condition is false.


Write a program that will graph using for loop?

A = 5do{statement;A = A + 1;} while (A < 10)


What is a loop type?

A Loop is a programming language construct that instructs the processor to repeat a sequence of operations a number of times until a specific condition is reached. There are different types of loops. They are: * for loop * while loop * do while loop


Why you need a for loop when you have already while loop or do while loop?

We need a for loop because the while and do-while loops do not make use of a control variable. Although you can implement a counter inside a while or do-while loop, the use of a control variable is not as self-evident as it is in a for loop. Aside from the use of a control variable, a for loop is largely the same as a while loop. However, it is quite different to a do-while loop, which always executes at least one iteration of the loop before evaluating the conditional expression. In a for and while loop, the conditional expression is always evaluated before entering the loop, which may result in the loop not executing at all.

Related questions

What is main different between do while and while?

If you want to execute a statement which is in while loop at least one time you can use do- while loop. this is why because initially first statements will be executed then condition will be checked. but in case of while first condition will be check then statements will be executed


How do you get the ouput as 11111 using while loop?

int i = 0; while( (i++) &lt; 5 ) { printf("1"); }


What is a nested loop in java?

A nested loop is a (inner) loop that appears in the loop body of another (outer) loop. The inner or outer loop can be any type: while, do while, or for. For example, the inner loop can be a while loop while an outer loop can be a for loop.


What is a C programming to calculate the sum of 1-2-3-4-5 and so on using while loop a for loop and a do while loop?

#include using std::cout;using std::endl;int main(){int number(1);cout number;//using loop forint sum(0);for(int i(1); i


How can you define null statement in loop in C programming?

If you are using for loop for(;;); or you can also define condition and iterations but the loop has to close there itself without any statement inside it. In the similar way you can define while and do while loop without any statement.


What are the similarities of while loop and a do while loop?

They both loop


C program algorithm for simple interest using while loop?

Not used


How do you create a loop (for loop, while loop) in Python?

In Python, you can create loops using different constructs, such as the for loop and the while loop. These loops allow you to repeatedly execute a block of code until a specific condition is met. Here's how you can create loops in Python: for loop: A for loop is used when you want to iterate over a sequence of elements such as a list, tuple, or string. It executes a block of code for each item in the sequence. for item in sequence: # Code block to be executed Here's an example that prints the numbers from 1 to 5 using a for loop: for num in range(1, 6): print(num) 2 while loop: A while loop is used when you want to repeat a block of code as long as a certain condition is true. It keeps executing the code block until the condition becomes false. while condition: # Code block to be executed Here's an example that prints the numbers from 1 to 5 using a while loop: num = 1 while num


Compare Do-While with While Statements?

A Do-While loop looks like this: do { loop body } while (condition); and a While loop looks like this: while (condition) { loop body } The main difference is that the loop body is always run once in the Do-While loop, then the condition is checked to see if the loop should keep running. In a While loop, the condition is checked first, and it will not run the loop body at all if the condition is false.


The while loop is a type of loop?

Is loop


Write a program that will graph using for loop?

A = 5do{statement;A = A + 1;} while (A < 10)


What is a loop type?

A Loop is a programming language construct that instructs the processor to repeat a sequence of operations a number of times until a specific condition is reached. There are different types of loops. They are: * for loop * while loop * do while loop