0% found this document useful (0 votes)
162 views2 pages

Assignment 1

The document provides 25 programming problems ranging from writing functions to perform operations like generating Fibonacci numbers and finding the smallest number in an array, to programs that print various patterns based on input like even/odd numbers within ranges, digits meeting certain criteria, and performing calculations on digits. Many problems involve reading input numbers and performing operations like reversing, summing, multiplying, or extracting digits before printing output.

Uploaded by

Sachin Chandra
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views2 pages

Assignment 1

The document provides 25 programming problems ranging from writing functions to perform operations like generating Fibonacci numbers and finding the smallest number in an array, to programs that print various patterns based on input like even/odd numbers within ranges, digits meeting certain criteria, and performing calculations on digits. Many problems involve reading input numbers and performing operations like reversing, summing, multiplying, or extracting digits before printing output.

Uploaded by

Sachin Chandra
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment-1

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. Write a recursive function that will generate and print the first n fibonacci numbers. Write a program to swap contents of two variables without using third variable. Write a program, which will delete only odd numbers from a array of integers. Write a function that takes three integers, x, y, z and returns an integer smallest among them. Write a function that determines if a number is prime. Use this function in a program that determines and prints all the prime numbers between 1 and 100. Develop a C program which adds all numbers from 1 to N, except those which are divisible by 5. Implement this using for loop and continue statement Write program, which reads 2 numbers and prints the sum of square of the first and cube of the second. Exa- input 5 3 output 5*5 + 3*3*3 = 52 . Write a program which reads 4 numbers and prints them in reverse order. Exa- input 4, 2, 3, 7 the output 7, 3, 2, 4 Write a program, which prints all even numbers between 20 and 70. Write a program, which prints all numbers between 20 and 40, and all even numbers between 50 and 80 Write a program which will print all even numbers less than 50 and all odd numbers more than 50. Write program, which print all even number between 20 and 40, and all odd numbers between 50 and 80. Write program, which will print all numbers, which are either a multiple of 3 or 5 but not both. Write program to delete last two digit. e. g. input 23617 output 2367. Write program to print the kth digit from last. e.g. input 23687 and k=3 output 6. Find the smallest number in an array using pointers. Write program to print the sum of digits. e.g. input 23516 the output 2+3+5+1+6=17. Write program to print digits, which are multiple of 3. e.g. input 23617 output 6, 3. Write program to print the biggest digit and its location( from last). e.g. in 23176 biggest digit is 7 and its location is 2 from last. Write program to print the location of biggest digit form beginning. Write program, which will find sum of product to consecutive digits. e.g. when the input is 23145 the output is 2*3 + 3*1 + 1*4 + 4*5 = 33.

23. 24. 25.

Write program, which reads a number the find special sum. If number is 2314 then output is 4 + 14 + 314 + 2314 = 2646. Write program, which reads a number the finds special product. If number is 2314 then output is 4 + 1*4 + 3*1*4 + 2*3*1*4 = 44. Write a program to copy the contents of one array into another in the reverse order.

You might also like