Question

In: Computer Science

Write a loop to print a list of numbers starting at 64 and ending at 339....

Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.

Solutions

Expert Solution

So, the loop that print the number from 64 to 339. There is no language was specified in your question. So i will write the code in C Language..

We will use "for loop" here. first we see the syntax of the for loop.

for(intialisation ; condition ; increment)

  1. intialisation : This refers to from where we want to start our loop, so we will write that value here.
  2. condition : To check the condition is right or not, after every cycle of loop the conditon is check, if condition is true then loop further execute, if condition is false then loop will end.
  3. Increment : in this block we will either increase or decrease the variable of the loop.

first we wil declare a variable for the loop as

int i; // this means we will have a variable i that is of type integer.

for(i=64; i<=339; i++)

  1. intialisation : Our loop is starting from 64, so i=64..
  2. condition : where we have to end our loop? at 339 right, so we started our loop from 64 then we will have to go to 339, so in this block i is less than or equal to(<=) 339..
  3. Increment : as above i is starting from 64 and end at 339 so what we have to do print the no. from 64 to 339 so in every cycle of loop we just have to increment the i by 1. so i++ just simply do i+1.

i++ : increment operator, which means i+1.

the whole program is

and the output is in Program in the line of printing the values of i :

printf("%d\t"i);

%d : is format specifier for integer,

\t : is used for giving the spaces between the values of i, as you see in the output screen.

KINDLY HIT LIKE!!!!!

As you ask for java code in comment so here it is

I have declare class Loop23, but you can choose your own name of class.

Look there is no diffrence in the Syntax in Loop in java and C in for and while loop. but the printing of the value was done diffrently.

KINDLY HIT LIKE!!!


Related Solutions

Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.(java language)
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax. in java
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
Write a loop to print a list of numbers starting at 64 and ending at 339....
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
1.Write a loop to print a list of numbers starting at 64 and ending at 339....
1.Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax. 2. Write a switch statement that uses the colour of a swab sample of COVID testing vehicle to send a message to a local doctor. Use the messages given for each colour in the table below. Justify your answer. Colour Message Blue “No virus” Yellow “Needs to be under observation” Red “Needs to be admitted in COVID ward” 3.
Write a for-loop in MATLAB that generates a list of numbers such that each number is...
Write a for-loop in MATLAB that generates a list of numbers such that each number is the sum of the previous three. Initialize your list of numbers at the values of 0, 0 and 1. In other words, "0" is the first element of the list, "0" is the second element of the list, and "1" is the third element of the list. What is the 20th value in the list?
Please, write a loop to print odd numbers an array a with pointers backwards. You can...
Please, write a loop to print odd numbers an array a with pointers backwards. You can use a variable “size” for array size.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT