Find Largest Number
Let there are three variables given: A, B and C
We need to check the largest number among all three
Find if A>B
Let there are three variables given: A, B and C
We need to check the largest number among all three
Find if A>B
- True:
- A>C
- True: A is the largest
- False: C is the largest
- False:
- B>C
- True: B is the largest
- False: C is the largest
Check by putting Example: A=1, B=2, C=3
Polynomial Multiplication
Given: ax+b, cx+d
Product: (ac)(x^2) +(ad+bc)x + cd
Take input as a, b, c, d.
Calculate and give their value in equation
int a, b, c, d means it allocated the storage for these four variables.
This storage is in the main memory.
Int stands for integer. This is called data type. Any variable have to be of some data type. There are few inbuilt data types available in language and others can be build by programmer
Memory point of View
Initially memory locations are empty. When we declare variables in main memory, we indicate the name of each location with some variable.
How reading input changes the memory: As soon as we give input/ assign some value to the variable, the location stores that value. If no value is assigned, it just means that the value is unknown (it does not means that it do not have any value).
ALU performs operations on these variables. It takes the value of variable, performs operation and stores it into another memory location.
No comments:
Post a Comment