Skip to main content

INTRODUCTION TO C++

LAB ACTIVITY: ( PAGE NO- 168)

1. Write programs in C++ for the following:

a) Find the sum of first 10 natural numbers.


b) Find the greatest among the three numbers.



c) Find if a given year is a leap year or not.








Comments

Post a Comment

Thank you so much to like us.

Popular posts from this blog

QBASIC STATEMENTS CLASS-VI

CONTROL STATEMENT-    The Control Statements are used for controlling the Execution of the program. We use control statements by two way 1) Unconditionally & 2) Conditionally GOTO STATEMENT- Unconditionally, we use GOTO statement. The Goto Statement is used for transferring the control to the other location for example- if you wants to transfer the control to the other place of the program then we can use the goto statement. When we use goto Statement then we have to supply a name along with a Goto Statement on which Control is transferred. The Name is user choice and Name must be defined with the help of a Colon. When Compiler transfers the Control of program to the Goto statement then statements of Goto block will be Executed and The Name of Goto Statements block is also called as the Label Name. GOTO statement uses line number or label Here, We will understand by an example CLS 1 PRINT " MY NAME IS  AMIT " :GOTO ABC 2 PRINT " I LI...

QBASIC ARRAY & GRAPHICS CLASS VIII

ARRAY in QBASIC  is used to store sequential values of same kind.We can use array instead of using number of separate variables. Using different variables to store values will makes our program lengthy and complicated. So, in such cases QBASIC provides us facility to store values of same type. So, Basically there are two types of array in QBASIC: 1) SINGLE DIMENSIONAL ARRAY 2) DOUBLE / TWO DIMENSIONAL ARRAY  SINGLE DIMENSIONAL ARRAY Declaration:-                        We use DIM keyword to declare array. Syntax: DIM  (number of items). Example:- DIM A(10) The above will open 10 dimensions in memory to store 10 numbers. i.e.    1              2           3           4           5      ...

QBASIC MULTIPLE CHOICE & SUB PROCEDURES CLASS VII

1) ELSEIF- When there are multiple choices and the user has to select one, the ELSEIF statement can be used. Example:- In the above program, program will determine greatest number among three entered number. Remember, while entering numbers , enter three different  numbers. Output:- 2) SELECT CASE:-  SELECT CASE , is used to automatically determine a program decision by checking the value of a variable. Syntax: - SELECT CASE variable CASE comparison value :  execution code : : : CASE ELSE END SELECT Example:- 1 We will make a program to print weekly day, by entering corresponding number.   In the above program, program will print day after entering corresponding day number. Output:-  Example:- 2   Output:-  In the above program we will enter character & program will show you related months staring from the entered character.   LAB ACTIVITY 1. Write Programs for the following problems. ...