Points to remember :
1. for( i =1,x=1;i<=5;x++,i++)
two variables can be assigned initial values. Both get incremented simultaneously.But the loop will go on till i is less than or equal to 5.
2. When you have nested loops, the inner loop gets executed completely,then it goes to outer loop.
3. A compund statement is a set of two or more statements.It is also caleed a block. [ICSE 2005]
4. for loop is fixed iterative type, where the loop repeat for a definite number of times. while and do - while varying iterative type , where the statements are repeated till the condition is true.
5.
1. Write a program to display the following :
a)
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
b)
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
c)
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
2. Write a program to input a number and check whether it is a Special number or not. A number is said to be Special number, if the sum of the factorial of each digit of the number is same as the original number. [ICSE 2011]
145= 1 ! + 4! + 5!
=1+24+120
=145
3. Write a program to input a number and check whether it is a Automorphic number or not. A number is said to Automorphic if the original number is present on the right of the square of the number.
5 is Automorphic = 25
25 is Automorphic =625
4. A number is said to be Neon , if sum of all the digits of square of a number is equal to the entered number.
9 = square is 81
= 8 +1
= 9
No comments:
Post a Comment