Question

Create a Visual Studio console project named exercise071 containing a main() program that in a single...

Create a Visual Studio console project named exercise071 containing a main() program that in a single statement declares an int array named primes and initializes the 5 entries to the first prime numbers. The primes start at 2 since 1 is not a prime number. Display the array on a single console line beginning with "Primes: " and a blank separating the numbers. A loop is not required.

Homework Answers

Answer #1

Code:

#include <iostream>

using namespace std;

int main()
{
int primes[5]={2,3,5,7,11};
/*Here we initialized the array primes with 5 elements 2 3 5 7 11*/
cout<<"Primes:"<<primes[0]<<" "<<primes[1]<<" "<<primes[2]<<" "<<primes[3]<<" "<<primes[4];
/*By using cout we print the 5 prime numbers with black spaces between them*/

return 0;
}

Output:

Indentation:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Create a new project in Visual Studio using C# Console Project. Declare an array of strings...
Create a new project in Visual Studio using C# Console Project. Declare an array of strings with the size of 12. Insert 12 different strings into the array. In a foreach loop display the contents of the array to the console.
C++ Visual Studio 2019 Write a C++ console application that accepts up to 5 numbers from...
C++ Visual Studio 2019 Write a C++ console application that accepts up to 5 numbers from the user. Display all numbers, the highest, the lowest, and the average of the numbers. Ask the user if they want to continue entering another set of numbers. 1) Use proper naming conventions for your variables and functions. 2) Tell the user what the program is all about. Do NOT start the program with “Enter a number”!! 3) Create an array to store the...
I need a few unit tests done on my SelectionSort program in Visual Studio 2019 with...
I need a few unit tests done on my SelectionSort program in Visual Studio 2019 with MSTest. My program is below. I just need screen shots of the unit test code in Visual Studio 2019 with MSTest. Please and thank you. using System; namespace SelectionSortAlgorithm { public class SelectionSort { public static void Main(string[] args) { int[] dataSet = new int[5] { 2, 99, 27, 68, 3 }; // 5 element array initialized int n = 5; // variable declar...
VISUAL STUDIO (NO JAVA CODING) Create a C# Console Application project to compute the tuition fee...
VISUAL STUDIO (NO JAVA CODING) Create a C# Console Application project to compute the tuition fee a student should pay. In this part of the assignment, you are required to create a C# Console Application project. Project name should be A2<FirstName><LastName>P1. For example a student with first name John and Last name Smith would name the project A2JohnSmithP1. Step 1: Ask if a student is a Canadian Citizen or an International Student. Also ask for their age. You must use...
Create a Java Program/Class named MonthNames that will display the Month names using an array. 1....
Create a Java Program/Class named MonthNames that will display the Month names using an array. 1. Create an array of string named MONTHS and assign it the values "January - December". All 12 months need to be in the array with the first element being "January", then "February", etc. 2. Using a loop, prompt me to enter an int variable of 1-12 to display the Month of the Year. Once you have the value, the program needs to adjust the...
In C# using the Console App (.NET FRAMEWORK) Create and test a Windows Console application that...
In C# using the Console App (.NET FRAMEWORK) Create and test a Windows Console application that displays the following patterns separately, one after the other. You MUST use nested for loops to generate the patterns, like the example in the PowerPoint slides from this chapter. All asterisks (*) should be displayed by a single statement of the form Console.Write("*"); which causes the asterisks to display side by side. A statement of the form Console.WriteLine(); can be used to move to...
Create a C Program called Summer_Heat that meets the following criteria: Lines 1,2: Identifies the name...
Create a C Program called Summer_Heat that meets the following criteria: Lines 1,2: Identifies the name of Program that the Programmer Lines 4,5: Includes the header files to allow input and output and use the system commands Line 7: Includes Declarations comment Line 8: Declares counter as an integer with an initial value of 0 Line 9: Initializes a double array called temperature using a single statement and the following 10 values 78.6 82.1 79.5 75.0 75.4 71.8 73.3 69.5...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF...
WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question, DO ADD COOMENTS AND DISPLAY THE OUTPUT OF A RUNNING COMPILER QUESTION: 1) Fibonacci sequence is a sequence in which every number after the first two is the sum of the two preceding ones. Write a C++ program that takes a number n from user and populate an array with first n Fibonacci numbers. For example: For n=10 Fibonacci Numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 2): Write...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an...
Arrays, loops, functions: Lotto Element Repeated Function Write a function that that takes as parameters an array of ints, an int value named element, and an int value named end. Return a bool based on whether the element appears in the array starting from index 0 and up to but not including the end index. Generate Random Array Write a function that takes as parameters an array of integers and another integer for the size of the array. Create a...
Subject- ( App Development for Web) ( language C#, software -visual studio) Exact question is-Firstly the...
Subject- ( App Development for Web) ( language C#, software -visual studio) Exact question is-Firstly the console calculator is created which perform multiply,divide,sub and add, operation and it accept all type of data (divide by 0 case as well ).Now the main motive is to create the library project from the console calculator project .Than we have to create a unit test project which test the functionality of added library.Make test like Test 1. multiply two positive number,Test 2. Add...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT