Vous êtes sur la page 1sur 3

Assignment of control statement

1. WAP to display even number from 2 to 40.


2. WAP to display sum of odd number from 3 to 99
3. WAP to accept n and display even number from 2 to n.
4. WAP to accept n and display factorial of n (n!)
5. WAP to accept x and p and display x raise to p
6. WAP to accept n and display sum of the following series
S= 1+1/2+1/3……………..1/n
7. WAP to accept x and n and display sum of following series
S= 1+x2+x3+x4………….xn
8. WAP to accept x and n and display sum of following series
S=1+1/x2+1/x3+1/x4………………..1/xn
9. WAP to accept x and display sum of following series
S= 1+x2+x4+x6………….xn
10. WAP to accept x and n and display sum of following series
S= 1+x2/2+x3/3+x4/4 .……….xn
11 WAP to accept x and n and display sum of following series
S= 1+x2/2-x3/3+x4/4 .……….xn
12 WAP to accept x and n and display sum of following series
S= 1+x2/2+x4/4+x6/6.……….xn
13 WAP to accept x and n and display sum of following series
S= 1+x2/2-x4/4+x6/6.……….xn
14 WAP to display the following series( Fibonacci series)
0,1,1,2,3,5,8,…………………N
15. WAP to display the following series(tribonaci series)
0,1,1,2,3,5,8,…………………N
16. WAP to display the following series
1,4,9,16……………100
17 WAP to accept N and display table of N (first 10 multiples).
18. WAP to accept N and display all number divisible by N
19. WAP to accept a number and check if it prime or composite.
20 WAP to accept N and display prime numbers from 1 To N.
21 WAP to accept a number and display reverse of a number
Eg. 7896 reverse is 6987
22 WAP to accept a number checks if it is a palindrome or not
Eg 1221, 3443, 4444, 2332 are palindrome
23 WAP to accept a number and find sum of all the digits of the number
Eg. 23245 sum of 23245 = 16
26 WAP to accept a number and find a digit in that number
27 WAP to accept N and check if N is an Armstrong number
An Armstrong number is a whose sum of cube of each digit is equal to
number
Eg. 153 is an Armstrong number 13+53+33=153
28. WAP to display the following pattern(lower triangle):-
1 * 1
12 ** 11
123 *** 111
1234 **** 1111
12345 ***** 11111
29 WAP to display the following pattern( upper triangle): -
12345 ***** 11111
1234 **** 1111
123 *** 111
12 ** 11
1 * 1
30 WAP to display the following pattern( star): -
*
***
*****
***
*
31 WAP to display the following pattern ( lower triangle)-
A
AB
ABC
ACBD
32 WAP to display the following pattern ( upper triangle): -
ABCD
ABC
AB
A
33 WAP to display the following pattern (upper triangle)
12345 ***** 11111
2345 **** 1111
345 *** 111
45 ** 11
5 * 1
34 WAP to display the following pattern ( lower triangle)
5 * 1
45 ** 11
345 *** 111
2345 **** 1111
12345 ***** 11111
35 WAP to display the following pattern
1234321
12321
121
1
36 WAP to display the following pattern
12345
1234
123
12
1
12
123
1234
12345
37 WAP to display the following pattern
1234567
23456
345
4
345
23456
1234567

Vous aimerez peut-être aussi