11/05

mail@pastecode.io avatar
unknown
text
3 years ago
654 B
3
Indexable
1) Write a program to Search an element in a array

Example :

Read n -> size of array
Read array of size n
Read k to search in array

n = 4, array = [12,4,5,6],  k = 5;

Example : Element 5 found at index 2


2) Write a program to print multiplication table of n;
Read n;

Example n = 2;

2 x 1 = 2;
2 x 2 = 4
2 x 3 = 6
...
..


3) Write a program to print even numbers up to N

Read n
Print even numbers up to N


4) Write a program to print factorial of a numer N

Read N
Print factororial of a number 

Example : 5
Output : 120

5) Write a program to check if number is a prime

Example1 : 7
Output : 7 is prime

Example2 : 5
Output : 4 is not prime