answersLogoWhite

0

write a program that reads in the size of the side of square and then pints a hollow square of that size out of asterisks and blanks?

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

How do you write a c program that prints a box an oval an arrow and a diamond?

You first learn how to program in C.


What is the solution of towers of hanoi problem?

This algorithm reads the value of number of discs and prints the move that are to be done for playing towers of hanoi.Pre: n is a positive integer which carries the value of number of discs.Post: prints the moves that are to be done for transferring discs in ascending order in another peg1.initialize value of n(positive integer greater than 1)2.moves = pow(2,disk)-13.if(n=1)i) moves disk from "from" to "to"4. end if5. elsei)hanoi(n-1,from,aux,to)ii) moves disc from "from" to "to''iii) hanoi(n-i,from,aux,to)6.end else7. prints the movesend towers_of_hanoi


Write a C program that will ask the user for 4 integer values and then produce the following output 1 The sum of the four numbers 2 The sum of the first two numbers minus the sum of the las?

#include<stdio.h> main() { int a,b,c,d; // The four integers to be asked printf("Give the first integer: "); //asks for the first integer scanf("%d",&a); // puts the user input in the address of the integer "a" printf("Give the second integer: "); //same explanations scanf("%d",&b); printf("Give the third integer: "); scanf("%d",&c); printf("Give the fourth integer: "); scanf("%d",&d); printf("1. The sum of the four integers is: %d",a+b+c+d); //prints the sum of the four integers given by the user, notice the "a+b+c+d" at the end) printf("2. The sum of the first two numbers minus the sum of the last: %d",a+b-c-d); //prints the second condition by putting the correct operations return 0; //ends the program } I never tested this program though, but i think it would work.


Program that prints every integer value from 1 to 20 along with its squared in java?

public class PrintValues { public static void main(String[] args) { for (int i = 1; i <=20; i++) { System.out.println("Value is: " + i); int sq = i * i; System.out.println(i + " Squared is: " + sq); } } }


Write a program that input a positive integer n and then prints a triangle of asterisk n lines high and 2n-1 columns wide?

#include<iostream.h> void main(void) { int n; cout<<"Enter A Value For Triangle:"<<endl; cin>>n; cout<<endl; for(int i=n;i>=1;i--) { for(int j=1;j<=i;j++) cout<<" "; for(int k=2*n;k>=2*i;k--) cout<<"*"; cout<<endl; } cout<<endl; cout<<endl; for(int l=0;l<=n-4;l++) cout<<" "; cout<<"ENJOY"<<endl<<endl; }

Related Questions

Writing a program which prints a text of 4 lines consisting of characters integer values and floating point values using print statement?

To write a program that prints a text of 4 lines consisting of integer and floating point values, you can use formatted strings in Python. Here's a simple example: int_value = 42 float_value = 3.14 print("Line 1: Integer value is", int_value) print("Line 2: Float value is", float_value) print("Line 3: Sum of values is", int_value + float_value) print("Line 4: Float value to two decimals is {:.2f}".format(float_value)) This code snippet prints four lines, showcasing both integer and floating point values.


How did menu's develop?

A restaurant prints it out using a special program


Create a program which accepts a number not less than 10The program prints the reverse of the number?

ten


How do you write a c program that prints a box an oval an arrow and a diamond?

You first learn how to program in C.


What is the solution of towers of hanoi problem?

This algorithm reads the value of number of discs and prints the move that are to be done for playing towers of hanoi.Pre: n is a positive integer which carries the value of number of discs.Post: prints the moves that are to be done for transferring discs in ascending order in another peg1.initialize value of n(positive integer greater than 1)2.moves = pow(2,disk)-13.if(n=1)i) moves disk from "from" to "to"4. end if5. elsei)hanoi(n-1,from,aux,to)ii) moves disc from "from" to "to''iii) hanoi(n-i,from,aux,to)6.end else7. prints the movesend towers_of_hanoi


Write a C program that will ask the user for 4 integer values and then produce the following output 1 The sum of the four numbers 2 The sum of the first two numbers minus the sum of the las?

#include<stdio.h> main() { int a,b,c,d; // The four integers to be asked printf("Give the first integer: "); //asks for the first integer scanf("%d",&a); // puts the user input in the address of the integer "a" printf("Give the second integer: "); //same explanations scanf("%d",&b); printf("Give the third integer: "); scanf("%d",&c); printf("Give the fourth integer: "); scanf("%d",&d); printf("1. The sum of the four integers is: %d",a+b+c+d); //prints the sum of the four integers given by the user, notice the "a+b+c+d" at the end) printf("2. The sum of the first two numbers minus the sum of the last: %d",a+b-c-d); //prints the second condition by putting the correct operations return 0; //ends the program } I never tested this program though, but i think it would work.


Program that prints every integer value from 1 to 20 along with its squared in java?

public class PrintValues { public static void main(String[] args) { for (int i = 1; i <=20; i++) { System.out.println("Value is: " + i); int sq = i * i; System.out.println(i + " Squared is: " + sq); } } }


Write a C program that prompts the user for three decimal numbers and prints them trimmed as integer values. For example, if the user informs the values 13.2, 12.5, 102.231, the program prints out 13, 12, 102?

Here's a simple C program that prompts the user for three decimal numbers, converts them to integers, and prints the trimmed integer values: c Copy code #include int main() { double num1, num2, num3; // Prompt the user for three decimal numbers printf("Enter three decimal numbers: "); scanf("%lf %lf %lf", &num1, &num2, &num3); // Convert and print the trimmed integer values int intNum1 = (int)num1; int intNum2 = (int)num2; int intNum3 = (int)num3; printf("Trimmed integer values: %d, %d, %d\n", intNum1, intNum2, intNum3); return 0; } In this program: We declare three variables num1, num2, and num3 to store the decimal numbers entered by the user. We use printf to prompt the user to enter three decimal numbers. We use scanf to read and store the user's input in the variables num1, num2, and num3. We then convert these decimal numbers to integers by casting them using (int) and store them in intNum1, intNum2, and intNum3. Finally, we use printf again to print the trimmed integer values. Compile and run the program, and it will prompt you for three decimal numbers and print their trimmed integer values as requested.


Write a program that input a positive integer n and then prints a triangle of asterisk n lines high and 2n-1 columns wide?

#include<iostream.h> void main(void) { int n; cout<<"Enter A Value For Triangle:"<<endl; cin>>n; cout<<endl; for(int i=n;i>=1;i--) { for(int j=1;j<=i;j++) cout<<" "; for(int k=2*n;k>=2*i;k--) cout<<"*"; cout<<endl; } cout<<endl; cout<<endl; for(int l=0;l<=n-4;l++) cout<<" "; cout<<"ENJOY"<<endl<<endl; }


Dry run table in flow-chart?

/* my second program in C++ with more comments */ #include <iostream> using namespace std; int main () { cout << "Hello World! "; // prints Hello World! cout << "I'm a C++ program"; // prints I'm a C++ program return 0; }


Which of the following is an example of a positive statement?

Prices rise when the government prints too much money.


Program in c to develop an algorithm that prints the n value of algorithm?

reymond rillera reymond rillera