#include
void main()
{
int i=2,m,n;
printf("enter number");
scanf("%d",&n);
do
{
m=i*n;
printf("%d*%d=%d\n",n,i,m);
i=i+1;
}
while (i<=10);
}
Um, not sure how to do that, but you can create a sort of "table" in C++ by using multidimensional arrays. Below is an example of how to create a two-dimensional array: int myArray[10] [10]; You can add more dimensions to the array in order to increase its storage capacity.
a = 0while a < 10 :a += 1print (a)Write the above simple script in a text editor (I use nano). Save as loop.py in home folder. To run, open a terminal and at the prompt, write: python loop.pyResult:rodney@downstairs:~$ python loop.py12345678910
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
Use a counted for loop. On each iteration, multiply the control variable by 2 and print the result.
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.
Algorithm: 1. From the user collect the integer whose table is required 2. Use a loop with loop counter starting with 0x01 and ends till the table value is required 3. start multiplication the input number with the loop variable and print the result.
Um, not sure how to do that, but you can create a sort of "table" in C++ by using multidimensional arrays. Below is an example of how to create a two-dimensional array: int myArray[10] [10]; You can add more dimensions to the array in order to increase its storage capacity.
the multiplication of the number of iterations with the number of statements in that loop is equal to loop length.
a = 0while a < 10 :a += 1print (a)Write the above simple script in a text editor (I use nano). Save as loop.py in home folder. To run, open a terminal and at the prompt, write: python loop.pyResult:rodney@downstairs:~$ python loop.py12345678910
/*mycfiles.wordpress.com Program to prepare Table of any no. using while loop*/ #include #include void main() { int n,t,count=1; clrscr(); printf("Enter any number\n\n"); scanf("%d",&n); while(count<=10) { t=n*count; printf("\n%d*%d=%d",n,count,t); count++; } getch(); }
By using repeated addition. Consider two numbers a and b. If you want to find a*b then you can add the numbers repeatedly in a loop to get the product. Eg:product = a;for( i=1; i
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
int i = 0; while( (i++) < 5 ) { printf("1"); }
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.
#include using std::cout;using std::endl;int main(){int number(1);cout number;//using loop forint sum(0);for(int i(1); i
They both loop
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.