A

@Aditya_Patra

Finding area and perimeter of rectangle in lua

Lua
4 years ago
--[[Write a program to find the area and perimeter of a rectangle--]] l = io.read('*n') b = io.read('*n') area = l*b per = 2*(l+b) print('Length of the rectangle is', l) print('Breadth of the rectangle is', b) print('Area of the rectangle is', area)

Finding area and perimeter of a square in lua

Lua
4 years ago
--[[Write a program to find the area and perimeter of a square--]] s = io.read('*n') area = s*s per = s*4 print('Side of the square is', s) print('Area of the square is', area) print('Perimeterof the square is', per)

Finding are and circumference of circle in lua

Lua
4 years ago
--[[Write a program to find the area and circumference of the circle--]] r = io.read('*n') area = 3.14*(r^2) cir = 2*3.14*r print('The radius is', r) print('The area of the circle is', area) print('The circumference of the circle is', cir)

Finding total and average of numbers in lua

Lua
4 years ago
mark1 = io.read('*n') mark2 = io.read('*n') mark3 = io.read('*n') tot_marks = mark1 + mark2 + mark3 avg_marks = tot_marks/3 print('The total marks are', tot_marks) print('The average marks are',avg_marks)

Finding square in lua

Lua
4 years ago
--[[Write a program to take one number display the square of given number--]] num1 = io.read('*n') print('the square of',num1,'=',num1*num1)

Finding Product of 2 numbers in lua

Lua
4 years ago
--[[Write a program to take two numbers and find the product of the same--]] num1 = io.read('*n') num2 = io.read('*n') print('The product =', num1*num2)

Operations in lua without variable

Lua
4 years ago
--[[Write a program to take two numbers from the user and display the sum, difference, product and quotient--]] num1 = io.read('*n') num2 = io.read('*n') print('The sum is', num1+num2) print('The difference is', num1-num2) print('The product is', nu

Operations in lua

Lua
4 years ago
--[[Write lua program to collect the name and age from the user and display their age after 5 years--]] print("Enter your name:\n") name = io.read() print('Enter your age:\n') age = io.read('*n') print("You are", name,"and of age", age) new_age = a

Taking input from user in lua

Lua
4 years ago
--[[Write lua program to take the anem and age from the user and display them--]] print('Enter your name:') name = io.read() print('Enter you age:') age = io.read('*n') print('You are', name, 'of age', age)

Printing variables in lua

Lua
4 years ago
--[[Write lua program to display values of two variables x, y having value of 25, 'Twenty five'--]] x = 25 y = 'Twenty five' print('The valiue of x is', x, 'and the value of y is', y)

Printing in lua

Lua
4 years ago
--[[Write lua program to print 'National Public School, Whitefield',blank line, Your name, blank line, Your age--]] print('National Public School, Whitefield\n') print('Aditya Patra\n') print('11')

S.E.A

Lua
4 years ago
billcost = io.read('*n') --[[billcost is the variable for original cost.--]] if(billcost >= 5000 and billcost < 10000)--[[checking if original cost is more than 5000 and less than 10000--]] then newcost = billcost-500 --[[making variable newcos

Input from user

Lua
4 years ago
name=io.read() io.write("Hi ", name)