I need your help in these questions in assembly language , work in visual studio
ID: 3694722 • Letter: I
Question
I need your help in these questions in assembly language , work in visual studio 2013
1. Write a program that asks the user to input an integer n and uses a loop to calculate the first nth values in the Fibonacci number sequence, for example if n=7, the program outputs:1,1,2,3,5,8,13. (Fibonacci numbers: the next number is found by adding up the two numbers before it.)
2. write a program that asks the user to enter an integer test score between 0 and 100 and displays the appropriate letter grade as the following table. This program is required to be able to continuously read the number grades from the user and convert them to letter grades until the user enters a grade of -1. Score Range Letter Grade ----------------------------------- 90 to 100 A 80 to 89 B 70 to 79 C 60 to 69 D 0 to 59 F Hint: Declare messages as follows for input .data str1 BYTE "Enter an integer score: ",0 str2 BYTE "The letter grade is: ",0
Explanation / Answer
1.
class FibonacciSeries
{
public static void main(String[] args)
{
java.util.Scanner scn = new java.util.Scanner(System.in);
System.out.println("Enter a number: ");
int n = scn.nextInt();
int a = 0;
System.out.print(a);
int b = 1;
System.out.print(b);
int c;
for(i = 1 ; i <=n ; i++)
{
c = a + b;
System.out.print(c);
a = b;
b = c;
}
}
}
2.
class TestGrade
{
public static void main(String[] args)
{
java.util.Scanner scn = new java.util.Scanner(System.in);
System.out.prinln("Enter an integer score: ");
int marks = scn.nextInt();
if((marks >= 90)&&(marks <= 100))
{
System.out.println(" The letter grade is: A ");
}
if((marks >= 80)&&(marks <= 89))
{
System.out.println(" The letter grade is: B ");
}
if((marks >= 70)&&(marks <= 79))
{
System.out.println(" The letter grade is: C ");
}
if((marks >= 60)&&(marks <= 69))
{
System.out.println(" The letter grade is: D");
}
if((marks >= 0)&&(marks <= 59))
{
System.out.println(" The letter grade is: F ");
}
}
}