Computer Science, asked by Ranit250, 4 months ago

3. Write a program in python to print the simple interest using the formula of principal*time* rate/100 on the basis of user input?

4.Write a python program to input the value of an year and print a message for leap year.

5. Differentiate between the following (any three)

a. syntax and run time errors
b. system and application software
c. list and tuples
d. compiler and interpreter
e. RAM and ROM​

Answers

Answered by himanshu2006vps
0

3)

P = float(input("Enter the principal amount : "))

N = float(input("Enter the number of years : "))

R = float(input("Enter the rate of interest : "))

#2

SI = (P * N * R)/100

print("Simple interest : {}".format(SI))

4)

year=int(input("Enter year to be checked:"))

if(year%4==0 and year%100!=0 or year%400==0):

print("The year is a leap year!)

else:

print("The year isn't a leap year!)

5) you said any three so I will choose a,d,e

a)syntax Errors: Errors that occur when you violate the rules of writing syntax are known as Compile-Time errors. This compiler error indicates something that must be fixed before the code can be compiled. All these errors are detected by the compiler and thus are known as compile-time errors.

Most frequent Compile-Time errors are:

Missing Parenthesis (})

Printing the value of variable without declaring it

Missing semicolon (terminator)

Run-Time Errors: Errors which occur during program execution(run-time) after successful compilation are called run-time errors. One of the most common run-time error is division by zero also known as Division error. These types of error are hard to find as the compiler doesn’t point to the line at which the error occurs.

d)Compiler transforms code written in a high-level programming language into the machine code, at once, before program runs,

whereas an Interpreter coverts each high-level program statement, one by one, into the machine code, during program run. Compiled code runs faster while interpreted code runs slower.

e)Random Access Memory (RAM) is used to store the programs and data being used by the CPU in real-time. The data on the random access memory can be read, written, and erased any number of times. RAM is a hardware element where the data being currently used is stored. It is a volatile memory.

Read Only Memory (ROM) is a type of memory where the data has been prerecorded. Data stored in ROM is retained even after the computer is turned off ie, non-volatile.

Similar questions