public class Pattern
{
public static void Main(string[] args)
{
int i=1,j=1,k=1,bl=0;
do {
//To add required predceding blank space
bl=(9-i)/2;
j=0;
do {
Console.Write(" ");
j++;
} while(j<=bl);
//To add required number of asterisks
k=1;
do {
Console.Write("*");
k++;
} while(k<=i);
//Next line
Console.WriteLine("");
//Incrementing count of asterisks
i=i+2;
} while(i<=9);
//Similar code as above but reverse pattern
i=7;
do {
bl=(9-i)/2;
j=0;
do {
Console.Write(" ");
j++;
} while(j<=bl);
k=1;
do {
Console.Write("*");
k++;
} while(k<=i);
Console.WriteLine("");
//Decrementing count of asterisks
i=i-2;
} while(i>=1);
}
}
do-while 5. Write a program in C# Sharp to display the patter like a diamond.
c++ ( while loop ) Write program to find and display the value of the function y ,given as following : y = 15x3 + √2x − 3, for the values of x in between 2 and 10, with an increment of 1.
Write a C++ program that uses a do or a while loop that has the user enter golf scores, terminated by a zero. After the zero has been entered, display the number of scores entered and their average.
Topics c ++ Loops While Statement Description Write a program that will display a desired message the desired number of times. The program will ask the user to supply the message to be displayed. It will also ask the user to supply the number of times the message is to be displayed. It will then display that message the required number of times. Requirements Do this assignment using a While statement. Testing For submitting, use the data in the...
java program
QUESTION 2: 1. Write a do-while loop that asks the user to select a task from the following menu to continue: 1. Option 1 2. Option 2 3. Option 3 4. Option 4 5. Exit Read the selection from the keyboard then write the switch statement: For option 1, display the message "Do the option 1" For option 2, display the message "Do the option 2" For option 3, display the message "Do the option 3" For option...
.using while loops(matlab) Write a program to display the sum of the series [ 9 + 99 + 999 + 9999 ...] Test Data : Input the number or terms :5 Expected Output : 9 99 999 9999 99999 The sum of the series = 111105
Write in C. Simple Program (beginner)
Assignment: Write a program Character Pointers and Functions. (like program #5-5). Keyboard input to enter one character string. Using a single dimension array, populate the array with the character string, call a function using pointers to reverse order the character string, pass back to the main the output and total_count_of_characters. (maybe use a global variable for the total count). Print display the reversed char string and total_count. <END>
c++ program that displays asterisk shapes of square, oval, arrow
and diamond that looks like the picture.
Write a C++ program. Using the while loop or the do – while loop write a program that does the following: Calculate the average of a series of homework grades (0 - 100) entered one at a time. In this case the lowest score will be dropped and the average computed with the remaining grades. For example suppose you enter the following grades: 78, 85, 81, 90, 88, 93 and 97.The average will be computed from the 6 grades 85,...
need help!! c++
HW_6b - Calculate the average Use a do-while loop Write a program that first prompts the user for an upper limit: Enter the number of entries: 5 € (user enters 5) After the user enters a number, the program should prompt the user to enter that many numbers. For example, if the user enters 5, then the program will ask the user to enter 5 values. Use a do-while loop to add the numbers. o With each...
C++ Programming
Write a C++ program that defines the 5 times 5 grid shown below. The program should then call a method to display the grid. The output should look like this: char board[5][5] =