0% found this document useful (0 votes)
36 views

C Problem

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

C Problem

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Ahsanullah University of Science and Technology

Department of Computer Science and Engineering


Section A: Basic Programs:
Question A1: WAP to input roll number, name, marks and phone of a student and display the values.
Question A2: WAP to input roll number, name and marks of a student in 5 subjects and calculate the total and average marks.
Display all the values.
Question A3: WAP to find out the square of a given number.
Question A4: WAP to input a number and print its cube.
Question A5: WAP to input radius and calculate the area and circumference of a circle.
Question A6: WAP to input length and breadth of a rectangle and calculate the area and perimeter.
Question A7: WAP to input 4 integers a, b, c, d and check that the equation a 3 + b3 +c3 = d3 is satisfied or not.
Question A8: WAP to input side of a square and calculate the area.
Question A9: WAP to input principle, rate and time from the user and calculate the simple interest and total amount. Display all
the values.
Question A10: WAP to input the number the days from the user and convert it into years, weeks and days.
Question A11: WAP to input a character and print its ASCII value.
Question A12: WAP to input a number and print its equivalent character code.
Question A13: WAP to find out the quotient and remainder of two numbers. (without using modulus (%) operator)
Question A14: WAP to input two numbers and print their quotient and remainder.
Question A15: WAP to input two numbers and print the greatest using conditional operator.
Question A16: WAP to input marks of a student and print the result (pass/fail) using conditional operator.
Question A17: WAP to input inches from the user and convert it into yards, feet and inches.
Question A18: WAP to find out the area of a triangle.
Question A19: WAP to find out the area of a right angle, equilateral, isosceles triangle.
Question A20: WAP to find whether a given number is even or odd using conditional operator.
Question A21: WAP to find out the greatest of three numbers using conditional operator.
Question A22: WAP to input choice (1 or 2). If choice is 1 print the area of a circle otherwise print the circumference of circle.
Input the radius from user.
Question A23: WAP to input a number. If the number is even, print its square otherwise print its cube.
Question A24: WAP to input employee code, name and basic salary of an employee and calculate the following values:
HRA 40 % of basic salary
DA 10 % of basic salary
CCA 5 % of basic salary
GS Basic + HRA + DA + CCA
PF 10 % of GS
IT 10 % of GS
NS GS – (PF + IT)
Display all the values.
Question A25: WAP to input the temperature in Fahrenheit and convert it into Celsius and vice versa.
Question A26: WAP to swap the values of two integer variables
(a) Using extra variable
(b) Without using extra variable
Question A27: WAP to print the system date.
Question A28: WAP to find the age of a person by the given date of birth.

Section B: Programs Based on Control Structures


Question B1: WAP to input the marks of a student and print the result (passing marks = 40 %).
Question B2: WAP to input the age of a person and check that he is eligible for license for not.
Question B3: WAP to check that a given year is a leap year or not.
Question B4: WAP to input a number and check whether it is even or odd.
Question B5: WAP to input a number and check that number is divisible by 7 or not.
Question B6: According to the Gregorian calendar, it was Monday on the date 01/01/1900. If any year is input through the
keyboard write a program to find out what is the day on 1 st January of this year.
Question B7: WAP to input the name and age of a person and display “CHILD” or “TEENAGER” according to the age.
Question B8: WAP to input the salary of a person and calculate the hra and da according to the following conditions:
Salary HRA DA
5000-10000 10% 5%
10001-15000 15% 8%
Question B9: WAP to input marks in five subjects of a student and calculate the division according to the following conditions:
Percentage Division

Page 1 of 9
Dept. of CSE, AUST (Elementary Structured Programming)

>=60 First
50-59 Second
40-49 Third
<40 Fail
Question B10: An electricity board charges according to the following rates:
For the first 100 units - 40 paisa per unit.
For the next 200 units - 50 paisa per unit.
beyond 300 units - 60 paisa per unit.
All users are charged meter charges also, which are Rs. 50/-
Question B11: WAP to input monthly salary from the user and calculate the income tax according to the following rules:
Salary income tax
>=9000 40% of the salary
7500-8999 30% of the salary
<7500 20% of the salary
Question B12: WAP to input the selling price and cost price from the user and determine whether the seller has made profit or
incurred loss. Also display the value of profit or loss.
Question B13: WAP to input a character and check that it’s a small letter, capital letter, a digit or a special symbol.
Question B14: WAP to input two integers and determine that first is multiple of second.
Question B15: WAP to input a character and check that it’s a vowel or a consonant.
Question B16: WAP to convert a small letter into capital letter and vice versa.
Question B17: WAP to input the marks of a student in five subjects and calculate the grade according the following conditions:
Marks Grade
>90 S
76-90 A
61-75 B
51-60 C
40-50 D
<40 Fail
Question B18: WAP to input the sales made by a salesman and calculate the commission according to the following conditions:
Sales Commission
1-10000 4%
10001-20000 5%
20001-30000 6%
>30000 7%
Question B19: WAP to convert the temperature according to the following conditions:
Choice Conversion
1 Fahrenheit to Celsius
2 Celsius to Fahrenheit
Question B20: WAP to find out the largest of three numbers.
Question B21: WAP to input three numbers and print them in descending order.
Question B22: WAP to input a number (1 to 7) and print the weekday name according to the given number.
Question B23: WAP to input a digit and print the digit in words.
Question B24: WAP to input two numbers and a choice and calculate the result according to the following conditions:
Choice Result
1 Add
2 Subtract
3 Multiply
4 Divide
5 Remainder
Question B25: WAP to input two numbers and an operator and calculate the result according to the following conditions:
Operator Result
‘+’ Add
‘-‘ Subtract
‘*’ Multiply
‘/’ Divide
‘%’ Remainder
Question B26: WAP to calculate the area of a circle, a rectangle or a triangle depending upon user’s choice.
Choice Area
1 Circle
2 Rectangle
3 Triangle

Page 2 of 9
Dept. of CSE, AUST (Elementary Structured Programming)

Question B27: WAP to input the marks in theory and practical and print the result.
Question B28: WAP to input a date (dd / mm / yyyy) and check for the validity of the date.
Question B29: WAP to print counting from 1 to 10.
Question B30: WAP to print counting from 10 to 1.
Question B31: WAP to print counting from 51 to 90.
Question B32: WAP to find out the sum and average of all the numbers within the given range.
Question B33: WAP to print all the numbers falling between 2 numbers entered by the user.
Question B34: WAP to print all the even numbers between 1 and 50.
Question B35: WAP to print all the odd numbers between 1 and 50.
Question B36: WAP to print the sum and average of first n natural numbers.
Question B37: WAP to print the sum and average of first n odd numbers.
Question B38: WAP to print the sum and average of first n even numbers.
Question B39: WAP to print the table of a given number.
Question B40: WAP to input 2 numbers and find out the sum of all the even numbers which are not divisible by 5 but divisible
by 3 and lies between the given two numbers.
Question B41: WAP to input the name and age of a person and print the name as many times as age.
Question B42: WAP to print whole screen with any character.
Question B43: WAP to print the factorial of a given number.
Question B44: WAP to input a number through the keyboard until a ‘.’. Every time a number is entered. The program should
display whether it is greater than, less than or equal to the previous number.
Question B45: WAP to check that given number is prime or not.
Question B46: WAP to input a number and count its even and odd digits and find out their sum separately.
Question B47: WAP to generate divisors of an integer.
Question B48: If a number 972 is entered through the keyboard, your program should print “Nine Seven Two”. Write the
program such that it does this for any positive integers.
Question B49: A positive integer is entered through the keyboard, along with it the base of the numbering system in which you
want to convert this number. WAP to display the number entered, the base and the converted number.
Question B50: WAP to input a number and separate the number in its individual digit and print the digits separated from one
another by three spaces each.
Question B51: WAP to convert a decimal number to equivalent binary number (fractions also).
Question B52: WAP to convert a decimal number to equivalent octal number.
Question B53: WAP to convert a decimal number to equivalent hexadecimal number.
Question B54: WAP to convert a binary number to the decimal number.
Question B55: WAP to convert a octal number to the decimal number.
Question B56: WAP to convert a hexadecimal number to the decimal number.
Question B57: WAP to convert a octal number to binary number.
Question B58: WAP to convert a hexadecimal number to the binary number.
Question B59: WAP to generate all combinations of 1, 2 and 3.
Question B60: WAP to find out the LCM and GCD of two given numbers.
Question B61: WAP to find out the least common divisor of two integers.
Question B62: WAP to check whether square root of a number is prime or not.
Question B63: WAP to find out the sum of the following series:
(1) 1 + x2/2! + x4/4! + x6/6! + …….xn/n!
(2) 1 - x2/2! + x4/4! - x6/6! + …….xn/n!
(3) 1 + 1/1! + 1/2! + 1/3! + …….
(4) 1 + 1/1! + 2/2! + 3/3! + …….
(5) x + x2/2! + x3/3! + x4/4! + …….xn/n!
(6) x - x2/2! + x3/3! - x4/4! + …….xn/n!
(7) 1 + 1/x + 1/x2 + 1/x3 + 1/x4 +………..
(8) x – x3/3! + x5/5! – x7/7! + x9/9! -…….xn/n!
(9) 1- 2/21 + 3/31 – 4/41 + 5/51……….
(10) 1 + x1/2! + x2/3!...................+ x N/(N+1)!
(11) 1 + x/2! + x2/4! + x3/6! + x4/8! +………..xn/(2n)!
(12) 1 + x/1! + x3/2! + x5/3! + x7/4! +………..x2n-1/n!
(13) 1 + x2/1! + x4/2! + x6/3! + x8/4! +………..x2n/n!
(14) 1 - x2/2! + x3/3! – x4/4! + …….xn/n!
(15) 1 + x2/2! + x3/3! + x4/4! + …….xn/n!
(16) x + x2/3! + x3/5! + x4/7! + x5/9! +…….xn/(2n-1)!
(17) x + x3/2! + x5/3! + x7/4! + x9/5! +…….x2n-1/n!
(18) x - x2/3! + x3/5! - x4/7! + x5/9! -…….xn/(2n-1)!
(19) a + ar + ar2 + ar3+…………+ar(n-1)

Page 3 of 9
Dept. of CSE, AUST (Elementary Structured Programming)

Question B64: Input two numbers from the keyboard. Write a program to find the value of one number raised to the power of
another.
Question B65: WAP to print all the ASCII values and their equivalent characters. The ASCII values vary from 0 to 255.
Question B66: WAP to check that given number is Armstrong number or not. ( if the sum of the cubes of each digits of the
number is equal to the number itself, then the number is called the Armstrong number. For example, 153 = (1*1*1) + (5*5*5) +
(3*3*3).
Question B67: 145 is a special number, since it satisfies the following relation:
145 = 1! + 4! + 5! = 1+24+120 =145
WAP to print all the numbers of this kind between 1 – 1000000.
Question B68: WAP to find out the sum of geometric series.
Question B69: WAP to print out all Armstrong numbers between 1 and 500.
Question B70: Square of 12 is 144. 21, which is a reverse of 12 has a square 441, which is same as 144 reversed. There are few
numbers which have this property. Write a program to find out whether any more such numbers exist in the range of 10 to 100.
Question B71: WAP to find out the difference between two dates in terms of numbers of days.
Question B72: WAP to input n numbers and calculate the sum, average, maximum and minimum of the given numbers. (use only
one variable to input the number and also find the second largest).
Question B73: WAP to print the sum of negative numbers, sum of positive even numbers and sum of positive odd numbers from
a list of numbers entered by the user.
Question B74: WAP to print the largest even number and largest odd number from the list of numbers entered through keyboard.
Question B75: WAP to determine all Pythagorean triplets in the range 100 to 1000.
(A Pythagorean triplet is a set of three integers i, j, k such that i2 + j2 = k2)
Question B76: WAP to print the following series:
(1) 2, 4, 8, 16, 32, 64, 128, 256
(2) 1, 4, 7, 10, …………… 40
(3) 1, -4, 7, -10……………-40
(4) 1, 5, 11, 19, 29 ……..
(5) (1) + (1+2) + (1+2+3) + (1+2+3+4) …………. up to n terms
(6) (2) + (2+4) + (2+4+6) + (2+4+6+8) …………. up to n terms.
(7) (1) + (1+3) + (1+3+5) + (1+3+5+7) …………. up to n terms
(8) (12) + (12+32) + (12+32+52) + (12+32+52+72) ……. up to n terms
(9) (22) + (22+42) + (22+42+62) + (22+42+62+82) ………up to n terms
(10) (13) + (13+33) + (13+33+53) + (13+33+53+73) ……. up to n terms
(11) (1/1!) + (2/3!) + (3/4!) + (4/5!) + (5/6!) ……. up to n terms
(12) log1 + log4 + log 9 + log16 + log25 + ….……. up to n terms
(13) log1 + log8 + log 27 + log64 + log512 + ….……. up to n terms
Question B77: WAP to calculate the root of quadratic equation.
Question B78: Write a menu driven program which has following options:
1. Factorial of a number.
2. Prime or Not
3. Odd or even
4. Exit.
Question B79: WAP to input a number and print its reverse number. Also check that the number is palindrome or not.
Question B80: WAP to input a number and find out the sum of its digits.
Question B81: WAP to find out the count of the digits of a given integer.
Question B82: WAP to print the Fibonacci series.
Question B83: WAP to input a name and print the name in the following pattern
R RAJAT
RA RAJA
RAJ RAJ
RAJA RA
RAJAT R

Question B84: WAP to print the following series:


1 1
12 22
123 333
1234 4444

1234 4444
123 333
12 22
1 1

Page 4 of 9
Dept. of CSE, AUST (Elementary Structured Programming)

5
54
543
5432
54321

A A
AB BB
ABC CCC
ABCD DDDD

ABCD DDDD
ABC CCC
AB BB
A A

* ****
** ***
*** **
**** *

ABCDEFGFEDCBA
ABCDEF FEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

0
1 0 1
1 0 1 0 1
1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1

0
1 0 1
2 1 0 1 2
3 2 1 0 1 2 3
4 3 2 1 0 1 2 3 4

A
A B A
A B C B A
A B C D C B A
A B C B A
A B A
A

Page 5 of 9
Dept. of CSE, AUST (Elementary Structured Programming)

Question B85: WAP to print the truth table for XY+Z.


Question B86: WAP to print the factorial of all the numbers till the given number.
Question B87: WAP to print the tables of all the numbers till the given number.
Question B88: WAP to input month number and year and print the calendar for the given month.
Question B89: WAP to find out the difference between two dates, in terms of days, months and years.
Question B90: WAP to add number of days or number of months in a given date.
Question B91: WAP to print all the prime numbers till the given number.

Section C: Programs Based on Strings


Question C1: WAP to count the number of spaces, tabs and new line characters in a given string.
Question C2: WAP to input a character and a string. Each occurrence of a character in the string should be converted to opposite
case i.e. upper to lower case or vice versa.
Question C3: WAP to count the number of words and number of characters in a given line of text except the spaces.
Question C4: WAP to input a multi word string and produce a string in which first letter of each word is capitalized.
Question C5: WAP to count the numbers of vowels, consonants, digits and special symbols in a given string.
Question C6: WAP to count the lower case and upper-case letters in a string.
Question C7: WAP to search a character in a given string.
Question C8: WAP to search a given string into another string and displays the position if found otherwise displays 0.
Question C9: WAP to find a substring of given string.
Question C10: WAP to extract specified number of characters from a given position from a string.
Question C11: WAP to count all the occurrences of a character in a given string.
Question C12: WAP to calculate the length of a string.
Question C13: WAP to input two strings and print which one is lengthier.
Question C14: WAP to reverse a string.
Question C15: WAP to check a string for palindrome.
Question C16: WAP to copy a string into another string.
Question C17: WAP to concatenate two strings.
Question C18: WAP to compare two strings.
Question C19: WAP to replace every space in a string with a hyphen, tab with a hash and digit with a slash.
Question C20: WAP to input a string and replace every lower case letter with upper case letter, upper case letter with a lower
case letter, digit with a ‘#’ and a special symbol with a ‘%’. Display the new string.
Question C21: WAP to encrypt and decrypt a string using your own method of encryption and decryption.
Question C22: WAP to reverse all the strings stored in an array.
Question C23: WAP to swap two strings stored in an array.
Question C24: WAP to input 5 strings in an array of strings and display all the strings with their lengths.
Question C25: WAP to search a string in the array of strings.
Question C26: WAP to display all the palindrome strings from the array of strings.
Question C27: WAP to convert a string into upper case and vice versa.
Question C28: WAP to extract given number of characters from the left of the string.
Question C29: WAP to extract given number of characters from the right of the string.
Question C30: WAP to extract given number of characters, from the desired location from the string.
Question C31: WAP that will print out all the rotations of a string. For example - the rotations of the word “abc” are
abc bca cab
Question C32: WAP that replaces two or more consecutive blanks in a string by a single blank.
Question C33: WAP to input 10 names in a 2D array of characters and replace the 1 st name with 5th name and display the
resultant array.
Question C34: WAP to input two strings consists of maximum 80 characters. Examine both the strings and remove all the
common characters from both the strings. Display the resultant string.
Question C35: WAP to test whether a string of opening and closing parentheses is well formed or not.
Question C36: WAP to evaluate a postfix expression given by the user.
Question C37: WAP to evaluate a prefix expression given by the user.
Question C38: WAP to convert a given infix expression to prefix and postfix expression.
Question C39: WAP to convert a postfix expression to the prefix expression and vice versa.
Question C40: WAP to convert a postfix expression to infix expression.
Question C41: WAP to input an arithmetic expression comprising of numeric constants and operators and evaluate the expression
at the input.
Question C42: Write a function which has two strings x and y as arguments. The function finds out the first symbol of x which
does not occur in y.
Question C43: Write a program to check that any one of given n strings occur in a string s.
Question C44: WAP to convert vowels into upper case character in a given string.
Question C45: WAP to read a file and remove the spaces between two words of its content.

Page 6 of 9
Dept. of CSE, AUST (Elementary Structured Programming)

Section D: Programs based on arrays


Question D1: WAP to input the marks of 10 students in an array of integers and display the marks.
Question D2: WAP to search how many times a number is present in an array.
Question D3: WAP to subtract two arrays of the same size.
Question D4: WAP to input the sales made by a salesman in every month of a given year and find out the total, average,
maximum and minimum sales.
Question D5: WAP to calculate the average of 10 values stored in an array and display all those values which are more than the
calculated average.
Question D6: WAP which finds the locations and values of largest and second largest element in a one dimensional array.
Question D7: WAP to reverse an array of floats.
Question D8: WAP to create a sorted list using arrays. Every time the element is entered in the array, the array must remain
sorted.
Question D9: WAP to rotate an integer array towards right by the given number of times.
Question D10: WAP to input 20 values in an integer array and count the negative, positive, odd and even values in the array.
Question D11: Given an array named A with following elements:
3, -5, 1, 3, 7, 0, -15, 3, -7, -8
WAP to shift the negative numbers to the left and positive numbers to the right so that the resultant array look like the
-5, -15, -7, -8, 3, 1, 3, 7, 0, 3
Question D12: WAP to copy the last 5 elements of array B after first 5 elements of array A. Assume length of A and B is greater
than 5.
Question D13: WAP to print all the palindrome numbers from an integer array and find out their sum.
Question D14: WAP to print all the prime numbers from an integer array and find out their sum.
Question D15: WAP to input 10 values in a float array and display all the values more than 75.
Question D16: WAP delete an element from the array and shift the elements
(1) Towards right.
(2) Towards left
Question D17: WAP to delete all the occurrences of a given value from the array and shift the remaining elements to the left of
the array.
Question D18: WAP to delete duplicate elements from an array.
Question D19: WAP to insert a value in the array at desired location.
Question D20: WAP to insert a value in the sorted array.
Question D21: WAP to sort an array.
(1) Using bubble sort technique
(2) Using selection sort technique
(3) Using insertion sort technique.
(4) Using Quick sort technique
(5) Using Heap sort technique.

Question D22: WAP to check that given array is sorted in ascending / descending order.
Question D23: WAP to search a value in the array using
(1) Linear search technique.
(2) Using binary search technique.

Question D24: WAP to count the number of occurrences of a given number in an integer array.
Question D25: An array consists of 50 integers in the range of 1 to 25, write a program that prints the number of times each
integer occurs in the array.
Question D26: A, B, C are the arrays of integers of size a, b, a + b, Write a program to produce a third array C containing all the
elements of array A and B.
Question D27: WAP to merge two arrays according to the following conditions:
First array Second array Resultant array
(1) Ascending Ascending Ascending
(2) Ascending Ascending Descending
(3) Ascending Descending Ascending
(4) Ascending Descending Descending
(5) Descending Descending Ascending
(6) Descending Descending Descending

Question D28: WAP to add and multiply two large integers, which cannot be represented by built in data types.
Question D29: WAP to delete all elements in between and occupying two specified positions.
Question D30: WAP to search the first occurrence a given sub array within another array.
Question D31: WAP to merge 4 arrays a, b, c, d in one array. All the arrays are in ascending order.

Page 7 of 9
Dept. of CSE, AUST (Elementary Structured Programming)

Section E: Two Dimensional arrays:


Question E1: WAP to input the values in a two-dimensional array of integers and display the values.
Question E2: WAP to display the values of a two-dimensional array in the matrix form.
Question E3: WAP to find out the row sum and column sum of a two dimensional array of integers.
Question E4: WAP to double all the elements of a matrix.
Question E5: WAP to print the left and right diagonal of a square matrix and find out their sum separately.
Question E6: WAP to find out the sum of non diagonal elements.
Question E7: WAP to display the upper and lower triangle of a matrix.
Question E8: WAP to find out the sum and difference of two matrices.
Question E9: WAP to find out the product of two matrices.
Question E10: WAP to find out the sum of negative, positive, odd and even integers separately from a two dimensional array.
Question E11: WAP to display those elements of a two dimensional array which are divisible by 10. Also find their sum.
Question E12: WAP to find out the sum of those numbers in the in a 2D array of integers which are divisible by 4 but less than
15.
Question E13: WAP to print all the prime numbers from a 2D array and find out their sum.
Question E14: WAP to transpose a square matrix.
Question E15: WAP to find the inverse of the matrix.
Question E16: WAP to find out the sum of the elements above and below the main diagonal of a square matrix.
Question E17: WAP to check the equality of two matrices.
Question E18: WAP to print all the elements of a square matrix except the diagonal elements.
Question E19: WAP to find the maximum, minimum and second maximum of a matrix.
Question E20: WAP to sort the elements of a matrix row- wise and column-wise.
Question E21: WAP to print squares of diagonal elements of a square matrix.
Question E22: WAP which finds the locations and values of largest and second largest element in a two dimensional array.
Question E23: Using a two dimensional array A[n*n], write a program to prepare a one dimensional array B[n 2] that will have all
the elements of A as if they are stored in column major form.
Question E24: Using a two dimensional array A[n*n], write a program to prepare a one dimensional array B[n 2] that will have all
the elements of A as if they are stored in row major form.
Question E25: WAP that receives the month and year from the keyboard as integers and prints the calendar of the given month.
(according to the Gregorian calendar 01/01/1900 was Monday)
Question E26: WAP to print the lower half and upper half of a square matrix.
Question E27: WAP to construct a magic square.
Question E28: WAP to find out the trace of a matrix.
Question E29: WAP to compute the determinant of a square matrix of real numbers.
Question E30: WAP to check if a Matrix is Sparse or Dense Matrix.

Section F: Programs based on Functions:


Question F1: Write a function that takes one integer argument and returns its square.
Question F2: Write a function to calculate the cube of a number.
Question F3: Write a function to calculate the area of a circle where radius is passed to the function as argument.
Question F4: Write a function to calculate the area of a rectangle where length and breadth are passed to the function as
argument.
Question F5: Write a function that has three arguments principle, rate and time and returns the simple interest.
Question F6: Write a function that accepts a character as argument and returns its ASCII value.
Question F7: Write a function to swap the values of two integer variables
(1) Using Extra variable
(2) Without using extra variable.
Question F8: Write a function that has one integer argument and returns 0 if number is even else returns 1.
Question F9: Write a function that has one character argument and displays that it’s a small letter, capital letter, a digit or a
special symbol.
Question F10: Write a function to print the sum and average of first n natural numbers where n is passed to the function as
argument.
Question F11: Write a function to print the sum and average of first n odd numbers where n is passed to the function as argument.
Question F12: Write a function that returns the factorial of a number where number is passed to the function as argument.
Question F13: Write a function that returns 1 if the number is prime and 0 if not prime. Number is passed to the function as
argument.
Question F14: Write a function that prints the sum of the digits, count of the digits and reverse of a number. Number is passed to
the function as argument.
Question F15: Write a function that returns the sum of the following series where x and n are passed to the function as argument.
(1) 1 + x2/2! + x4/4! + x6/6! + …….xn/n!
(2) 1 - x2/2! + x4/4! - x6/6! + …….xn/n!
(3) 1 + x/2! + x2/4! + x3/6! + x4/8! +………..xn/(2n)!

Page 8 of 9
Dept. of CSE, AUST (Elementary Structured Programming)

(4) 1 + x/1! + x3/2! + x5/3! + x7/4! +………..x2n-1/n!


(5) 1 + x2/1! + x4/2! + x6/3! + x8/4! +………..x2n/n!
Question F16: Write a function that has two integer arguments and returns first number raised to the power second number.
Question F17: Write a function called zero_small that has two integer arguments being passed by reference and sets the smaller
of two numbers to 0.
Question F18: Write a function that receives a string (character array) as argument and produces a string in which first letter of
each word is capitalized.
Question F19: Write a function that receives a string and a character as argument and returns 1 if the character is found in the
string else returns 0.
Question F20: Write a function to search a given string into another string and returns the position if found otherwise returns 0.
Both the strings are passed to the function as argument.
Question F21: Write a function to return the length of the string. String is passed to the function as argument.
Question F22: Write a function to reverse a string.
Question F23: Write a function to search a string in the array of strings. String and array of strings should be passed to the
function as parameters.
Question F24: Write a function to copy one string into another string. Both the strings are passed to the function as argument.
Question F25: Write a function to compare two strings. The strings must be passed to the function as argument. The function
should return 0 if the strings are equal else returns 1.
Question F26: Write a function to extract given number of characters from the right of the string. String and integer must be
passed to the function as argument.
Question F27: Write a function to evaluate a prefix / postfix expression.
Question F28: Write a function to sort an array using:
(1) bubble sort technique
(2) selection sort technique
(3) insertion sort technique
Array is passed to the function as argument.
Question F29: Write a function to delete an element from the array. Array, element to be deleted and size of the array are passed
to the function as argument.
Question F30: Write a function that receives an array and a number as argument and returns number of occurrences of the
number in the array.
Question F31: Write a function that receives an array and a number as argument and returns 1 if the number is found in the array
else returns 0. (Search the number using binary search)
Question F32: Write a function that has three arrays a, b, c as arguments of size m, n and m + n respectively. The array a is in
ascending order, b is in descending order and function should merge both the arrays and stores them in c in descending order.
Question F33: Write a function that receives a 2D array of integers as argument and prints the sum of row elements and column
elements separately.
Question F34: Write a function to find out the product of two matrices. Matrices are passed to the function as argument.
Question F35: Write a function to transpose a square matrix. Matrix is passed to the function as argument.
Question F36: Write a function to check the equality of two matrices. Matrices are passed to the function as argument and
function returns 1 if they are equal else returns 0.
Question F37: WAP to display all array elements using recursion.
Question F38: WAP to find power of any number using recursion.
Question F39: Write a function to find all the perfect numbers between given interval.
Question F40: Write a function to find all the strong numbers between given interval.
Question F41: Write a function to check if a number is magic or not.

Page 9 of 9

You might also like