Pascal Triangle Program In Qbasic3/27/2021
It is named after French mathematician Blaise Pascal, but it was used in China 3 centuries before his time.Then, to get the numbers of following rows, add the number that can be seen above and to the left (if any) and the number above and to the right (if any) to find the new value.For example, the numbers 1 and 3 in the fourth row are added to make 4 in the fifth row.In general, when a binomial is raised to a positive integer power we have.
The three-dimensional version is called Pascals pyramid or Pascals tetrahedron. A higher-dimensional analogue is generically called a Pascals simplex. In a binomial expansion, this second number is equal to the power. This makes the first row, 1, actually the zero row). And C is the variable where we will save the result in Celsius. In this article, we will see some QBasic programming examples and some simple exercises to understand how it works. These Qbasic program examples are a beginner-level, which mostly will help you to understand the concept of a variable and some basic qbasic statements like PRINT, INPUT, CLS etc. Here are some Qbasic commands along with the descriptions that will be used in this article. Before getting started it is important to know the basic Qbasic statements or QBasic commands first. Pascal Triangle Program In Qbasic Code Some SimpleIf you have not read about it, check: QBasic Commands and Statements-2020 Here, we will code some simple examples which are easy to understand for class 6 class 7 students, who have started with QBasic programming. Here, the program codes are explained with there formulas to help you understand better. Write a qbasic program to enter your name, city, country, age and print them. Write a program to find out the simple Interest and the Amount. Write a QBasic program to convert temperature from Fahrenheit to Celsius Write a QBasic program to convert temperature from Celsius to Fahrenheit FAQ How do you convert Celsius to Fahrenheit in Qbasic How do you convert Fahrenheit to Celsius in Qbasic Example of some Qbasic Programming Examples and Exercises EXAMPLE 1: Write a QBasic program to enter your name and print it. CLS INPUT Enter your name;n PRINT The name is;n END Here since the input data is a string then the variable name ( n ) in which it is to be stored is written after INPUT command followed by sign( n ). EXAMPLE 2: Write a qbasic program to enter your name, city, country, age and print them. CLS INPUT Enter the name;N INPUT Enter the city;C INPUT Enter the country;CO INPUT Enter the age;A PRINT The name is;N PRINT The city is;C PRINT The country is;CO PRINT The age is;A END Here name, city, country are string so its variable name is written with sign before it and since age is a number so the variable name is written directly. And is the variable to store the value of the result and print it as output. CLS INPUT Enter the length;l INPUT Enter the breadth;b LET A lb PRINT The area of rectangle;a END Example 4: Write a program to find the area of the triangle. Here in this program we that variable b as base and h as height. CLS INPUT Enter the base;b INPUT Enter the height;h LET T 12bh PRINT The area of triangle;T END Example 5: Write a program to find the area of the circle. CLS INPUT Enter the radius;R LET C227R2 PRINT The area of circle;C END Example 6: Write a program to find the area of the square. CLS INPUT Enter the number;n LET square n2 PRINT The area of square;Square END Example 7: Write a program to find the volume of the box. The variable are l, b, and h for length, breadth and height and the result will be stored in the variable volume. CLS INPUT Enter the length;l INPUT Enter the breadth;b INPUT Enter the height;h LET volume lbh PRINT The volume of box;volume END Example 8: Write a program to find the circumference of the circle. FORMULA: circumference 227 x Radius x 2 CLS INPUT Enter the radius; R LET Circumference227R2 PRINT The area of circle; Circumference END Example 9: Write a program to find out the Simple Interest. FORMULA: Simple Interest Principle x Rate x Time 100 CLS INPUT Enter the Principal;P INPUT Enter the Rate;R INPUT Enter the Time;T LET I PTR100 PRINT The simple Interest;I END Example 10: Write a program to find out the simple Interest and the Amount. FORMULA: Simple Interest Principle x Rate x Time 100 Amount Principle Simple Interest CLS INPUT Enter the Principal;P INPUT Enter the Rate;R INPUT Enter the Time;T LET I PTR100 LET A P I PRINT The simple Interest;I PRINT The amount;A END Example 11: Write a QBasic program to convert temperature from Fahrenheit to Celsius Formula (Convert Fahrenheit to Celsius): C (F 32) (5 9) Here F is the variable that will store the INPUT value.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |