Question

Using the Windows Starter Visual Studio project create the following two programs. 1. Write a program...

Using the Windows Starter Visual Studio project create the following two programs.

1. Write a program that will loop three times and raise the number 25 to the third power (25pts).
(25*25*25) Note: Make sure you have a large enough memory for the final number

2. Write a program using a whileSum that adds one to the index until it is five (25pts).

Sample:

        mov sum, 0     ; sum := 0

        mov ecx, 1     ; count := 1

whileA: cmp sum, 1000 ; sum < 1000 ?

        jnl endwhileA ; exit if not

        add sum, ecx   ; add count to sum

        inc ecx        ; add 1 to count

        jmp whileA     ; repeat

endwhileA:

mov eax, nmbr
whileCount: cmp icount, 3
jnl endwhileCount
imul eax, 25
mov rslt, eax
add icount, 1
jmp whileCount
endwhileCount:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Question 1:

Here a new Console Application in C# is created using Visual Studio 2017 with name "Demo_Loop".This application contains a class with name "program.cs".Below are the files associated with this program.

Program.cs :

//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//application namspace
namespace Demo_Loop
{
class Program//Class
{
//Main method
static void Main(string[] args)
{
//declaring variable
int sum = 0;
//for loop will execute three times
for (int i = 0; i < 3; i++)
{
//calculate and add to sum
sum = sum + 25 * 25 * 25;
}
Console.WriteLine("Sum is : "+sum);
//display sum
}
}
}

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :Program.cs

***********************************************************

Question 2 :

Here a new Console Application in C# is created using Visual Studio 2017 with name "Demo_BasicApp".This application contains a class with name "program.cs".Below are the files associated with this program.

Program.cs :

//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//application namespace
namespace Demo_BasicApp
{
class Program //Class
{
//Main method
static void Main(string[] args)
{
//declaring variable
int index = 0,sum = 0;
//while loop will execute till index is less than 5
while(index <5)
{
index = index + 1;//increment value of i
sum = sum + index;//calculate sum
}
//display index and Sum
Console.WriteLine("Value of Index :"+index+" Sum :"+sum);
//to hold the screen
Console.ReadLine();
}
}
}

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :Program.cs

Add a comment
Know the answer?
Add Answer to:
Using the Windows Starter Visual Studio project create the following two programs. 1. Write a program...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using the Windows Starter Visual Studio project create the following five programs. 1. Write a p...

    Using the Windows Starter Visual Studio project create the following five programs. 1. Write a program that will store address information in unique values and then display the full address in a window at runtime (10pts). Example: Sam Coder 1 Main Street Kansas City, MO 64018 2. Write a program that will swap the City and State fields and then display the full address in a window at runtime (10pts). Example: Sam Coder 1 Main Street MO, Kansas City 64018...

  • I need help creating this code. Write an assembly program (MASM and Irvine's libraries) that calculates...

    I need help creating this code. Write an assembly program (MASM and Irvine's libraries) that calculates and prints out the first five Fibonacci numbers FO=0; F1=1; F2=1; F3=F1+F2; F4=F3+F2; F5=F4+F3 If we use 0, 1 and initial conditions the sequence would be: 0, 1, 1, 2, 3 Use the ebx, eax, and ecx registers. Note WriteHex, Writelnt, WriteDec, all use eax So use ebx for first and eax for second and ecx for temporary The calculation could go something like...

  • **This program is to be created using Visual Studio C#**Create as a Windows Form application** 1....

    **This program is to be created using Visual Studio C#**Create as a Windows Form application** 1. Output a header in the console: “This is a replacement program” 1. Output a header that states: “This is Program 5” 2. Output a thank you message: “Thank you for running the program.”

  • Please write below code in C++ using Visual Studio. Write program that uses a class template...

    Please write below code in C++ using Visual Studio. Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) • Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 • Hint: Use vectors and vector functions to store the set of items 2. Get the number of items in the...

  • Using Microsoft Visual Studio. 1) Complete the following C++ program by adding more line of code...

    Using Microsoft Visual Studio. 1) Complete the following C++ program by adding more line of code for 8-bit signed array, 16-bit unsigned array, 16-bit signed array, 32-bit signed array and 32-bit signed array. 2) Fill in all the blanks in Table 1 using your completed code, following the hints provided within the table. 3) Fill in all the blanks in Table 2 using your completed code, following the hints provided within the table. C++ Program #include <stdio.h> #include <iostream> int...

  • C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to...

    C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to store the following data on a company division: Division Name (East, West, North, and South) Quarter (1, 2, 3, or 4) Quarterly Sales The user should be asked for the four quarters' sales figures for the East, West, North, and South divisions. The data for each quarter for each division should be written to a file. The second program will read the data written...

  • Write a program using Visual Studio 2017 that accepts four (4) lines of input: • The...

    Write a program using Visual Studio 2017 that accepts four (4) lines of input: • The first line contains a float value in 4.2f format • The second line contains a char value • The third line contains a 4-digit int value • The fourth line contains a char value and then displays all of the input on a single line Phone Number Write a program that accepts a phone number of the form +1(xxx)-xxxxxxx where x is a digit,...

  • NOTE: explain the lines in comments for better understanding Write an assembly program (for x86 processors...

    NOTE: explain the lines in comments for better understanding Write an assembly program (for x86 processors - Irvine) that has two procedures, a main procedure and a procedure called Fib. The fib procedure is to uses a loop to calculate and printout the first N Fibonacci numbers. Fibonacci sequence is described by the following formula: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n – 1) + Fib(n – 2). The value of N is to be communicated to this...

  • Write Verilog program, verify using test benches using monitor/display/strobe and provide output for the following programs....

    Write Verilog program, verify using test benches using monitor/display/strobe and provide output for the following programs. 28 integer count; initial begin count = 0; repeat (128) /7 from 0 to 127 begin $display ("Count = %d", count); count -count+1; end end 29 word address = 0; repeat (memory_size) / repeat for a number of times begin memory [word_address] 0i word address -word address + 1; end 30 reg clock initial begin clock = 1'b0; forever #10 clock -clock; end 31....

  • using Microsoft Visual Studio C++ write a compute program that will allow the user to: 1.Get...

    using Microsoft Visual Studio C++ write a compute program that will allow the user to: 1.Get a Factorial (using a loop) 2. perform addition and subtraction 3.allow the user to quit the program

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT