0% found this document useful (0 votes)
22 views6 pages

Extra Programs

PYTHON PROGRAM

Uploaded by

KARPAGAVALLI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views6 pages

Extra Programs

PYTHON PROGRAM

Uploaded by

KARPAGAVALLI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

ANNEXURE-I

Additional Programs for Fast Learners


1. If we list all the natural numbers below 10 that are multiples of 3 or 5, we
get 3,5,6 and 9 . The sum of these multiples is 23. Find the sum of all the
multiples of 3 or 5 below N.
Input Format:
First line contains T that denotes the number of test cases. This is followed by T lines,
each containing an integer, N.

Output Format:
For each test case, print an integer that denotes the sum of all the multiples of 3
or 5 below N.
Sample Input 0
2
10
100
Sample Output 0
23
2318

2. Each new term in the Fibonacci sequence is generated by adding the previous
two terms. By starting with 1 and 2 , the first 10 terms will be:
1,2,3,5,8,13,21,34,55,89 ………..
By considering the terms in the Fibonacci sequence whose values do not exceed N,
find the sum of the even-valued terms.
Input Format
First line contains T that denotes the number of test cases. This is followed by T lines,
each containing an integer, N.
Output Format

Print the required answer for each test case.


Sample Input 0
2
10
100
Sample Output 0
10
44

3. A palindromic number reads the same both ways. The smallest 6 digit palindrome
made from the product of two 3-digit numbers is. 101101=143x707.

Find the largest palindrome made from the product of two 3-digit numbers which is less
than N.
Input Format
First line contains T that denotes the number of test cases. This is followed by T lines,
each containing an integer, N.

Output Format

Print the required answer for each test case in a new line.
Sample Input 0
2
101110
800000
Sample Output 0
101101
793397

4. 2520 is the smallest number that can be divided by each of the numbers from 1 to 10
without any remainder.
What is the smallest positive number that is evenly divisible (divisible with no
remainder) by all of the numbers from 1 to N?
Input Format
First line contains T that denotes the number of test cases. This is followed by T lines,
each containing an integer, N.

Output Format

Print the required answer for each test case.


Sample Input 0
2
3
10
Sample Output 0
6
2520

5. Find the greatest product of K consecutive digits in the N digit number.


Input Format
First line contains T that denotes the number of test cases.
First line of each test case will contain two integers N & K.
Second line of each test case will contain a N digit integer.
Output Format

Print the required answer for each test case.


Sample Input 0
2
10 5
3675356291
10 5
2709360626
Sample Output 0
3150
0

6. You need to take an integer input and then draw the pattern according to it. Say
for example if you enter 5 then, the pattern should be like this-
1
333
55555
7777777
999999999

Input Format
You will take an integer input n from stdin.

Constraints
1 <= n <= 1000

Output Format
Your output should be the pattern according to the input which you had entered.
7. You need to take an integer input and then draw the pattern according to it. Say
for example if you enter 5 then, the pattern should be like this-

1
222
33333
4444444
555555555

Input Format
You will take an integer input n from stdin.

Constraints
1 <= n <= 1000

Output Format
Your output should be the pattern according to the input which you had entered.

8. You need to take an integer input and then draw the pattern according to it. Say
for example if you enter 4 then, the pattern should be like this-
A
CCC
EEEEE
GGGGGGG

Input Format
You will take an integer input n from stdin.

Constraints
1 <= n <= 13

Output Format
Your output should be the pattern according to the input which you had entered.

9. You need to take an integer input and then draw the pattern according to it. Say
for example if you enter 5 then, the pattern should be like this-
A
ABC
ABCDE
ABCDEFG
ABCDEFGHI

Input Format
You will take an integer input n from stdin.
Constraints
1 <= n <= 26

Output Format
Your output should be the pattern according to the input which you had entered.

10. You need to take an integer input and then draw the pattern according to it. Say
for example if you enter 5 then, the pattern should be like this-
0
101
21012
3210123
432101234

Input Format:
You will take an integer input n from stdin.

Constraints:
0 <= n <= 1000

Output Format:
Your output should be the pattern according to the input which you had entered.

Sample Test Case 1

Input
5
Output

0
101
21012
3210123
432101234

You might also like