Write a program that: program starts; declares and initializes to 10 an integer variable i; uses a do loop; print on new line “loop pass # “ and i; if i = 4 break default decrement i by 1 by stating i once; test condition i > 0; just before ending print on new line “Program finished!” then terminate program.
Program:
#include <stdio.h>
int main() {
int i=10; // declares and initializes to 10 an integer variable i
do // uses a do loop
{
printf("\nloop pass # %d",i); // print on new line “loop pass # “ and i
if(i==4) // if i = 4 break default decrement i by 1 by stating i once
break;
i--;
}while(i>0); // test condition i > 0
printf("\nProgram finished!\n"); // just before ending print on new line “Program finished!”
return 0;
}
Output:

Any doubts leave a comment
Write a program that: program starts; declares and initializes to 10 an integer variable i; uses...
1) Write a program that: program starts; declares and initializes to zero an integer variable score; declares and initializes to zero a float variable total; uses a for loop statement with integer x initialized to 1 going 5 iterations hence x<5 incremented by 0; input from keyboard integer score in range of 0 to 99; print on new line input value; adds score to total; switch x equals 3 break default x++; after exiting the loop calculate the average score;...
Homework Part 1 Write a C program that declares and initializes a double, an int, and a char. You can initialize the variables to any legal value of your choosing. Next, declare and initialize a pointer variable to each of the variables Using printf), output the following: The address of each of the first three variables. Use the "Ox%x" format specifier to print the addresses in hexadecimal notation The value of each variable. They should equal the value you gave...
// Group Names: // Date: // Program Description: // Import required packages //--> // Declare class (SwitchDoLab) //--> { // Declare the main method //--> { // Declare Constant integers SUM = 1, FACTORIAL = 2, QUIT = 3. //--> //--> //--> // Create an integer variable named choice to store user's option. //--> // Create a Scanner object // Create...
You are given an integer array in the console program which declares and initializes it as follows, for example: int int_array[] = {1, -3, 23, 4, 9, 2, 29, -3, 0, 2, 48, 7, 6, -1}; In that array there are n elements, where 0 < n < INT_MAX. Your program is to find the largest sum of any consecutive elements in that array. In the above example, the largest sum is obtained by adding 23, 4, 9, 2, 29,...
Write a C program named space_to_line.c that features a while loop that continuously reads input from the user one character at a time and then prints that character out. The exception is that if the user inputs a space character (‘ ‘), then a newline character (‘\n’) should be printed instead. This will format the output such that every word the user inputs is on its own line. Other than changing the spaces to newlines, the output should exactly match...
USING MATLAB. Design a program which uses a for…end loop to add 10 to a variable V five times. Use a counter variable to count the number of iterations that pass and display this count after the program exits the loop. To design your program, create a flow chart and iteration table (choose he starting variable V = 20). Once it is designed, code it and step through the loop to confirm your iteration table.
Hello. I just need help with my c++ code. Write a program that: Creates an integer variable AND an integer pointer variable Ask the user to input an integer value Store the value in the integer variable Print the address of the variable. Make the pointer variable point at the integer value Print the value pointed to by the pointer Print the address of the pointer
Write and submit the source code for the following program. The program will use an integer array of size 10 to store the prices of smartphones. It will then determine and print the prices of the most expensive and cheapest phones. Use the following variables: int[] prices = new int[10]; // Array of smartphone prices Assignment Ask the user for the price of each smartphone (using a for loop) Sort the list of smartphones (once) from low to high price...
C program: 1: Write a program that uses 5 threads. Initialize a shared variable with a value of 100. Each thread must add its Thread ID (tid) to the shared variable. Once a thread has done the addition, print the ID of the thread. [Note: thread does the printing] Output the value of the shared variable once all threads have finished incrementing it. [Note: main code does the printing] Provide a text file with your comments on the results of...