Question: I'm using C#, trying to get this to loop the incorrect answers to give a second attempt and then give a score. using System; namespace

I'm using C#, trying to get this to loop the incorrect answers to give a second attempt and then give a score.

using System;

namespace FileName { class Program { public static void Main(string[] args) { String name = "My Name"; String courseName = "Course Name"; String assignmentName = "Assignment Name"; int answer; Console.WriteLine("Name: " + name); Console.WriteLine("Course Name: " + courseName); Console.WriteLine("Assignment Name: " + assignmentName); //used as a header to identify me, the course, and the assignement

Console.WriteLine(" Question 1: The blue whale is the largest mammal."); Console.WriteLine("1 = True 2 = False"); //Question 1 and answers

Console.WriteLine("Choose the correct answer"); //prompts user to answer question

answer = Convert.ToInt32(Console.ReadLine()); String correct_or_wrong = 1 == answer ? "Correct" : "Incorrect"; Console.WriteLine(correct_or_wrong); //lets user know if they were correct or incorrect

Console.WriteLine(" Question 2: What is the longest river in the world?"); Console.WriteLine("1 = Amazon River 2 = Nile River 3 = Congo River 4 = Yellow River"); //Question 2 and answers

Console.WriteLine("Choose the correct answer"); //prompts user to answer question

answer = Convert.ToInt32(Console.ReadLine()); correct_or_wrong = 2 == answer ? "Correct" : "Incorrect"; Console.WriteLine(correct_or_wrong); //lets user know if they were correct or incorrect

} } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!