Question Bank - C Programming

I/IV B.Tech –Semester-1/2
Course Code: Problem Solving Through Programming
Course code: 13-Es101
Question
Build an algorithm and draw flowchart to display even numbers between 1 and n
Develop an algorithm and draw flowchart to find area of circle having radius r.
Build an algorithm and draw flowchart to check if the given alphabet is vowel or consonant
Describe the task performed by the following algorithm and then draw the flowchart for this
algorithm.
(i)
(ii)
(iii)
(iv)
(v)
(vi)
Start
N,i are the inter variables
Read n value from the keyboard
i=1
If i<=n then do
a. If i%2!=0 then do
i. Print I value
b. i=i+1
Goto step (v)
stop
Build an algorithm and draw flowchart to implement arithmetic calculator
Develop an algorithm and draw flowchart to calculate sum of the digits in a given number
Build an algorithm and draw flowchart to read marks of a student in 3 subjects and display averages
Develop an algorithm and draw flowchart to calculate sum of squares of the digits in a given number
Build an algorithm and draw flowchart to display nature and value of roots of a quadratic equation.
Develop an algorithm and draw flowchart to find area of a triangle having base b and height h.
Build an algorithm and draw flowchart to display odd numbers between 1 and n
Develop an algorithm and draw flowchart to find perimeter of a rectangle having length L and width
W.
Build an algorithm and draw flowchart to display even numbers between 1 and n
Develop an algorithm and draw flowchart to find area of a square having side s.
Build an algorithm and draw flowchart to display 1 to n natural numbers.
Develop an algorithm and draw flowchart to display sum of the factors of the given number.
Build an algorithm and draw flowchart to calculate factorial of a given positive integer
Develop an algorithm and draw flowchart to find perimeter of a square having side s.
Build an algorithm and draw flowchart to display 1 to n natural numbers in reverse order.
Develop an algorithm and draw flowchart to find area of a parallelogram having base b and height h.
Build an algorithm and draw flowchart to calculate and display sum of 1 to n natural numbers.
In a family there are 3 children:2 Boys and a Girl. Their Grand-father decides to give 10 chocolates to
the youngest person among them. Design an algorithm to know who that luckiest person is.
Build an algorithm and draw flowchart to calculate and display sum of 1 to n even numbers.
1
Analyze the following Flowchart and describe the task performed by this flowchart. Build an algorithm
to this flowchart.
Build an algorithm and draw flowchart to calculate and display sum of 1 to n odd numbers.
Write an algorithm and draw flowchart to find area of a rectangle having length L and width W.
Build an algorithm and draw flowchart to display even numbers between 20 and 120
Develop an algorithm and draw flowchart to calculate and display Simple Interest
Build an algorithm and draw flowchart to display odd numbers between 20 and 120
Develop an algorithm and draw flowchart to display largest of 3 numbers
Build an algorithm and draw flowchart to check if the given number is prime number or not
Develop an algorithm and draw flowchart to display Multiplication table of a given number.
Build an algorithm and draw flowchart to display reverse of the given number
Develop an algorithm and draw flowchart to calculate and display power of a number i.e., XY
Build an algorithm and draw flowchart to check if the given number is palindrome number or not
Develop an algorithm to find LCM of given 2 numbers
Develop an algorithm and draw flowchart to display Fibonacci series up to n numbers (Ex:- 0 1 1 2 3 5
8 13…..)
Develop an algorithm to find GCD of given 2 numbers.
Develop an algorithm and draw flowchart to display Lucas sequence up to n numbers (Ex:-2 1 3 4 7 11
18 …..)
Draw a Flowchart to check whether the number is a prime Number or Not.
Question
My friend Ramesh said, “if two programs are giving same output for every input then those two
programs are equal”. Now consider the following two programs and then find out whether they are
equal or not according to the statement given by Ramesh, and explain the reason.
2
Develop a Program to find whether the given year is a leap year or not a leap year.
Develop a program for arithmetic calculator.
Develop a program to read a positive integer between 1 to 12 (including 1 and 12) and then print its
corresponding month name using switch-case.
Build a program to check whether the given number is EVEN or ODD
Develop a complete C program that reads a value in the range 1 to 12 and print the name of that
month and the next month: Print error for any other input value. (For example, print “May followed
by June” if the input is 5. Note that December is followed by January).
Build a program to read a character from the user and then find out whether it is vowel or consonant.
Develop a program to read a positive integer between 1 to 12 (including 1 and 12) and then print its
corresponding month name using else-if ladder.
Build a program to read a C alphabet and then print "DIGIT" if it is between 0 to 9 else print "LETTER"
if it exists between 'a' to 'z' or between 'A' to 'Z' else print "SPECIAL SYMBOL" using else if ladder
Develop a program to read age of a person and then find out whether he is eligible for vote or not
eligible for vote.
Develop a program to find whether the given number can be divisible by both 5 and 7 or not.
Develop a program to read a decimal digit (0-9) and then print it in word using switch-case.
Explain difference between else-if ladder and switch-case statements with example.
Develop a program to read a 3-digit positive number and then display that number in words.
Ex:i/p = 123
o/p = one two three
Build a program to read a positive integer and then find out whether it can be divisible by both 3 and
5 or not divisible by 3 and 5.
Develop a program to read a decimal digit (0-9) and then print it it in word using else-if ladder.
Build a program to find the smallest number among three given numbers.
Develop a program to read a positive integer between 1 to 7 (including 1 and 7) and then print its
corresponding weekday name using else if ladder.
Develop a program to read a C alphabet and then print "DIGIT" if it is between 0 to 9 else print
"LETTER" if it exists between 'a' to 'z' or between 'A' to 'Z' else print "SPECIAL SYMBOL" using switchcase statement
Develop a program to read a positive integer between 1 to 7 (including 1 and 7) and then print its
corresponding weekday name using switch case.
In a factory weekly wages of workers is calculate as follows:3

First 35hrs are considered as regular hours.

Hours exceeding 35hrs are considered as overtime.
Develop a Program to input worker’s name, hours worked and rate per hour, and then print name
and total wages. Overtime wages is paid @ 2 times the rate
Develop a program to read three sides of a triangle and then find out a triangle can be formed or not.
(NOTE: if sum of any two sides should be greater than third side then a triangle can be formed )
Build a Program to input Name and basic pay of an employee and then print name, HRA and Special
allowance. HRA is 20% of basic or Rs. 7000/ whichever is less and Special allowance is 10% of basic pay
whenever basic exceeds Rs 10000. Otherwise it is 5% of basic pay.
Develop a program to read three sides of a triangle and then find out whether it is a right angle
triangle or not.
Develop a program that takes two integers A and B and checks whether both are “double digit”
numbers or not. If any one of them is not double digit number then print “false” and end the program.
If both are double digit numbers then print “odd sum”, if sum of A and B is odd else print “even sum”,
if sum of A and B is even.
Develop a program to find the roots of a quadratic equation for the given a, b, c values.
Sales tax is calculated on the basis of sales as follows:Sales
Sales tax
Upto Rs. 5000
2%
Above Rs. 5000
3%
Develop a C Program to input sales amount and print sales amount, sales tax and total amount.
Develop a program to read a number and then find out whether it is a double digit number or not.
Build a program that will display Grade of student according to his/her marks using if-else ladder.
1.
Marks > 80 then Grade = A
2.
Marks between 61 & 80 then Grade = B
3.
Marks between 51 & 60 then Grade = C
4.
Marks between 41 & 50 then Grade = D
5.
Marks between 35 & 40 then Grade = E
6.
Marks <35 then ‘F’ (Fail)
Develop a program to find whether the given number is positive or negative or zero number.
The grading in an academic institution is done according to the following rules
Average Marks
Grade
80 to 100
Honors
60 to 79
First Division
50 to 59
Second Division
40 to 49
Third Division
0 to 39
Fail
Implement this program using if-else ladder.
Develop a program to find whether the given number is positive or negative or zero number using
switch-case statement.
Using switch – case statement write a program to take two integer operands and one arithmetic
operator from the user and perform the operation and print the calculated value.
Develop a program to read a positive integer between 1 to 12 (including 1 and 12) and then print its
corresponding month name using switch case.
Build a program for current billing System based on the given requirements using if else ladder.
Units Consumed
0-200
Rate of Charge
Rs. 0.50 per unit
4
201- 400
Rs. 0.65 per unit in excess of 200 units 401- 600
Rs. 0.80 per unit in excess of
400 units
>=601
Rs. 1.00 per unit in excess of 600 units
Develop a a Menu driven program to find the Areas of:
1. Square 2. Circle
3. Rectangle 4. Triangle.
Build a menu driven program to implement the following operations.
i.
Area of a circle
ii.
Area of a triangle
iii.
Area of rectangle
Develop a program to read a positive integer between 1 to 12 (including 1 and 12) and then print its
corresponding month name and number of days in that month for a leap year using else-if ladder.
Distinguish between pre increment and post increment with examples
Develop a program to read a positive integer between 1 to 12 (including 1 and 12) and then print its
corresponding month name and number of days in that month for a non leap year using switch-case
Question
Explain while statement with the help of an example.
Develop a program using for loop to calculate the average of first n natural numbers?
Build a program to print sum of digits in a given positive integer number N.
Explain about for statement with example program
Explain nested do-while statement with the help of an example.
Develop a program to print n to 1 natural numbers by exit control loop?
Build a computer program to find the GCD of given 2 positive integers using control loops?
Develop a program to print the message(Hai how are you) up to n times by using entry control loop?
Illustrate the difference between pre-entry control loop and exit control loop with an example?
Develop a program to find out sum of ‘n’ natural numbers from 1 to 10 using exit control loop?
Build a program to print the multiplication tables between 1 to 10 by using control loops?
Develop a program to calculate sum of squares of first n even numbers by using entry control loop?
Build a program to find out factorial of a number using exit control loop?
Develop a program to produce following output for given number of rows R:
1
12
123
1234
……..
……….
Build a program to accept a number and print mathematical table of the given number?
Develop a program to find whether the given number is a strong or not by using control
loops?(145=1!+4!+5!=145)
Build a program to print sum of odd digits in a given positive integer number N.
Develop a program to produce following output for given number of rows R:
*
**
***
5
****
……..
……….
Build a program to find whether the given number is a prime or not by using control loops?
Explain nested for statement with the help of an example?
Build a program to print sum of even digits in a given positive integer number N.
Develop a program to calculate sum of squares of first n odd numbers by using entry control loop?
Build a program to print the Fibonacci series by using entry control loop ( 0 1 1 2 3 5 8 13 21 34. . . . .)
Develop a program to find whether given number is prime palindrome or not by using control loops?
Build a program to print the Lucas series by using entry control loop( 2 1 3 4 7 11 18 29 . )
Develop a program to print prime palindrome numbers between 1 to 100 by using control loops?
Build a program to find the LCM of given 2 positive integers using control loops?
Develop a program to print Armstrong numbers between 1 to 500 by using control loops?
Build a computer program to find the given number is palindrome number or not by using entry
control loop?
Illustrate the difference between while loop and for loop with an example?
Build a program to find whether given number is mirror number or not(121=121) by using exit control
loop?
Develop a program to produce following output for given number of rows R:
1
23
345
4567
……..
……….
Build a program to read an integer number and find the number of digits of the number
Find whether the following two C programs are generating the same output or not and describe the
execution of the programs.
//Program-1
// Program-2
#include<stdio.h>
void main()
{
int x=1;
while(x<50)
{
if(x%2==0)
printf(“%d”,x);
x++;
}
}
#include<stdio.h>
void main()
{
int x=2;
while(x<50)
{
printf(“%d”,x++);
x++;
}
}
Build a program to read an integer number and find the largest digit of given positive number
6
Develop a program to produce following output for given number of rows R:
1
2 3
4 5 6
7 8 9 10
Build a program to find reverse of a number.
Develop a program to produce following output for given number of rows R:
1
2 2
3 3 3
4 4 4 4
Build a program to read an integer number and find the smallest digit of given positive number
Develop a program to produce following output for given number of rows R:
A
B C
D E F
G H I J
K L M N O
Question
A businessman stores his monthly sales progress in an Array. He wants to arrange the sales in
increasing order and identifies the highest and lowest sales recorded in that year. Provide a solution
for this with a program.
Develop a program to read N strings from the user and then arrange them in dictionary order.
Build a program to read N integers and then delete a given number d from the array.
Develop a program to delete a given string from the given list of N strings, and then print the
remaining strings.
Build a program to find the product of the given two n×m and r×c matrices.
Develop a program to insert a given string into a list of N strings in a specified position.
Build a program to find the transpose of a given matrix.
Develop a program to read two strings str1 and str2 and then find out whether the string str2 is the
substring of str1or not.
Build a program to read N integers from the user, randomly, and then arrange them in ascending
order.
Develop a program to read two strings str1 and str2 and then find out whether the string str2 is the
substring of str1 or not. If it is a substring then print the position where it appeared.
Build a program to find given matrix is a symmetric matrix or not.
Develop a program to read a string and a character and then insert the character into a specified
position of the given string.
Build a program to read N number of student’s 3 subject marks and then find average marks of each
student, average marks of each subject of all students and overall class average marks.
7
Develop a program to read a string and a character and then delete that character from the given
string if it exists in that string and then print the remaining string.
Build a program to read N integers from the user, randomly, and then arrange them in descending
order.
Develop a program to read a long text and then find the number of characters, number of vowels,
number of consonants, number of digits, number of words, number of white spaces, and number of
special symbols.
Demonstrate the Initialization of an Array at Compile – time. Write a program to check the availability
of a Student in an 80 Students Section using Arrays
Develop a program to read amount (integer number) and then print that amount in text form. For
example given number is 3012 then output is “three thousand towel rupees ”.
Build a program to read marks of N subjects of a student and then find out his average marks.
Develop a program to read two strings str1 and str2 from the user and then find whether the given
two strings are equal or not without using string.h library functions.
Build a program to find the minimum and maximum integers positions if they are available in the
given 1-D array of elements.
Develop a program to read a line of text and a string str1to count how many number of times str1
exist in the given line of text.
Build a program to find the positions of largest and smallest elements in the given 2-D array of
integers.
Develop a program to read a line of text and a string str1 and then delete string str1 from the given
line of text if it exists otherwise print appropriate message.
Write a program to find biggest integer among the given N integers using 1-D array
Develop a program to read a line of text and a string str1and then insert str1 in a specified position of
the given text.
Build a program to find the average of given N positive integers and then find out the number of
elements exist less than the average and greater than the average.
Develop a program to read a line of text and then find the reverse text of the given text.
Build a program to find addition and subtraction of given two matrices.
Develop a program to read a line of text and then replace each word with its reverse word in the line
of text.
Build a program to check whether given two matrices are equal or not.
Develop a program to read a line of text and then arrange all words in a sorted order based on the
length of individual words.
Build a program to read N integers into an array and then reverse the given array of elements and
then print it.
Develop a program to read a line of text and then arrange all individual words in dictionary sorted
order in that line of text.
Build a program to read N elements into an array and find average of given N elements.
Develop a program to read a line of text and then change vowel letters of the given line of text into
upper case letters and all consonants letters of the given line of text into lower case letters.
Build a program to read 10 digits randomly into an array of size 10 and then find out a long integer,
which contains the concatenation of all those digits from left to right of the given array of digits as
shown below example
input
1
9
3
4
2
7
3
9
5
0
8
output
1934273950
Develop a program to read a line of text and a string str1 and then replace each occurrence of str1
with its reverse string in the given line of text.
Build a program to read N integer numbers from the user and find the median of those numbers using
arrays
Develop a program to read a line of text and then convert that long text into a long string.
Question
Build a function reverse and call this function in main to find the reverse of the given integer number.
What is a recursion? Write a recursive function to find n!
Build a function sum and call this function in main to calculate sum of the digits of the given integer
number
Analyze the execution and output of the following program and then find out the problem statement
to which the following computer program is the solution.
#include<stdio.h>
int fun(int,int,int);
void main(){
int n;
printf(“\nenter n value\n”);
scanf(“%d”,&n);
if(fun(n,0,1))
printf(“\nhello\n”);
else
printf(“\nhai\n”);
}
int fun(int n,int s,int i){
if(i<n){
s = s+((n%i==0)?(i):(0));
i=i+1;
return fun(n,s,i);
}
else if(n==s)
return 1;
else return0;
}
Build a function to return largest value, call this function in the main to find largest among two values.
Analyze the execution and output of the following program and then find out the problem statement
to which the following computer program is the solution.
#include<stdio.h>
int fun(int,int,int);
void main()
9
{
int n;
printf(“\nenter n value”);
scanf(“%d”,&n);
if(fun(n,0,1);
printf(“\nHello\n”);
else
printf(“\nhai\n”);
}
int fun(int n ,int c,int i)
{
if(i<=n)
{
c=c+((n%i==0);
i=i+1;
return fun(n,c,i);
}
else if(c==2)
return 1;
else
return 0;
}
Build a function isprime and call this function in main to check given number is prime or not
Build a recursive function to find gcd of two numbers
Explain the concept of call by value and call by reference with an example
Build a recursive function power that computes xy ,whare y is a real constant and x is an integer
Build a function to return largest integer value and call this function in main to find largest of a given
list of integer values. Write separate function to read values into the array.
Build a program to reverse an integer using a recursive function
Build a function to read and display a matrix. Call them in the main to read the element of a matrix
from key board and display it
Build a recursive function isprime() that returns 1 if its argument is a prime number and returns zero
otherwise.
Build a Program for addition of two given matrices using functions to read, display and add the
matrices.
Build a recursive function that will generate a given element of Fibonacci sequence. Use this function
in main to print first n elements of Fibonacci sequence
Build a Program for subtraction of two given matrices using functions to read, display and subtract the
matrices
Build a function for searching an element with function prototype
Int binarysearch(int data[], int key, int lower, int upper) and call this function in main() to test binary
search function.
Build a function that will scan string passed as an argument and convert all lower case character into
their uppercase equivalents.
Using recursive functions implement a program to print all prime numbers between given two
positive numbers N,M where N<M
Develop a User – defined function to calculate the power of a Number
10
Using recursive functions implement a program to print all strong numbers between given two
positive numbers N, M where N<M
Build a program to return GCD of two numbers and call this function in main to find GCD and LCM of
four given numbers?
Build a Program to find median of unsorted list of numbers using a function.
Build a function to return factorial of a number and call this function in main to find the value of the
Binomial coefficient C(n,r)
Build a function to reverse the elements of an array. Use this in main to display the given list in
reverse order. Write separate function to read values into the array
Build a Program for multiplication of two given matrices using functions to read, display and multiply
the matrices.
Build a function to find the factorial of an integer and use it to write a program for finding the number
of combinations C(n,r), given the values of n and r.
C(n,r)= n!/(n-r)! r!
Build a recursive function for binary search with function prototype.
int binsearch(int data[],int key, int lower, int upper); and call this function in main() to get the position
of element.
Build function that can be called to find the largest element of an mXn matrix and write separate
function to read values to the matrix.
Build a function which imitates the behavior of strlen() function. Use this function to check if a given
string is a palindrome or not
Question
Define a user defined data type student. The student structure contains student Id, Name, age, and 3
subject marks. Implement a program to read N number of student records and search for a given
student Id and print that record if it is available otherwise print “student does not exists”.
Define a user define data type Employee. The employee structure contains employee Id, Name, age,
salary. Implement a program to read N number of employee records and search for a given employee
id. If it is available then print that record otherwise “employee record not exists”.
Define user defined data type Book. A Book structure contains its title, author name, ISDN number
and price. Implement a program to read N number of books information and then arrange those
records in sorted order based on its price.
Define user defined data type Book. A Book structure contains its title, author name, ISDN number
and price. Implement a program to read N number of books information and then arrange those
records in sorted order based on author name.
Define a user defined data type course. A course structure contains course name, Faculty name,
semester number and fee. Implement a program to read N number of courses information and then
arrange those records in sorted order based on its fee.
Define a user defined data type course. A course structure contains course name, Faculty name,
semester number and fee. Implement a program to read N number of courses information and then
11
arrange those records in sorted order based on its semester number.
Define user defined data type Book. A Book structure contains its title, author name, ISDN number
and price. Implement a program to read N number of books information and then arrange those
records in sorted order based on its title.
Define a user define data type Employee. The employee structure contains employee Id, Name, age,
salary. Implement a program to read N number of employee records and display the employee details
who are getting salary more than given amount.
Define a user define data type student. A student structure contains his/her id number, Name and 3
subject marks. Implement a program to read N number of student records randomly and display the
student name and average, out of N number of students who got highest and second highest average.
Define a structure that can describe a hotel. It should have members that include the name, address,
grade, average room charge and number of rooms.
Write functions to perform the following operations:
a) To print out hotels of given grade in order of charges.
b) To print out hotels with room charges less than a given value.
Define a user defined data type Student. A student structure contains his/her Id, Name, age, and 3
subject marks. Implement a program to read N number of student records randomly and then arrange
those based on their average marks
Create a Structure for 10 Students with RollNo, Name and Age. Categorize the details according to
their Age
Define a structure called cricket that will describe the following information:
Player name, team name, batting average.
Using cricket, declare an array player with 50 elements and write a program to read the information
about all the 50 players and print a team wise list containing names of players with their batting
average.
Define user defined data type Book. A Book union contains its title, author name, ISDN number and
price. Implement a program to read N number of books information and then arrange those records
in sorted order based on its price.
Define a user defined data type course. A course union contains course number, semester number
and fee. Implement a program to read N number of courses information and then display.
Define user defined data type Book. A Book union contains its title, author name, ISDN number and
price. Implement a program to read N number of books information and then arrange those records
in sorted order based on its title.
Define a user define data type student. A student union contains his/her id number, and 3 subject
marks. Implement a program to read N number of student records randomly and display the average,
out of N number of students who got highest average.
Create a union with RollNo and Age. Read 2 student details and check the 2 student’s age are equal or
not. If equal display students are same age.
Create a union with student number and total mark. Read two student details and compare the
student total marks. Display student details who got highest total.
Define a union that can describe a hotel. It should have members that include the hotel phone
number, grade, average room charge and number of rooms.
Write functions to perform the following operations:
a) To print out hotels of given grade in order of charges.
b) To print out hotels with room charges less than a given value.
Define a union called cricket that will describe the following information:
Player id number, team name, batting average.
12
Using cricket, declare an array player with 50 elements and write a program to read the information
about all the 50 players and print a team wise list containing of players id number with their batting
average.
Define a union that represent a complex number (contains two floating point members, called real
and imaginary). Write a C program to add, subtract and multiply two complex numbers.
Write a program using structure to read and display the information about student.
Write a program, using structure, to find the biggest of three numbers.
Write a program using structure to read two points and then calculate the distance between them
Write a program to read and display information of a student, using a structure within a structure.
Write a program to read and display the information of all students in the class. By Using structure.
Write a program to read and display the information of all students in the class. Then edit the details
of the ith student and display the entire information. By Using structure.
Write a program to read, display, add, and subtract two distances. Distance must be defined in kms
and metres. By Using structure.
Write a program, using pointer to structure, to initialize the members in the structure. Use function to
print the students information like rollno, name, coursefee.
Write a program to read, display, add, and subtract two time defined using hour, minutes, and values
of seconds. Create a structure having hour,min,sec.
Define user defined data type Book. A Book structure contains its title, author name, ISBN number
and price. Implement a program to read N number of books information and then arrange those
records in sorted order based on its IDBN.
Define a user defined data type course. A course structure contains course name, Faculty name,
semester number and fee. Implement a program to read N number of courses information and then
arrange those records in sorted order based on its course name.
Define a user defined data type course. A course structure contains course name, Faculty name,
semester number and fee. Implement a program to read N number of courses information and then
arrange those records in sorted order based on its faculty name.
Define a user define data type student. A student structure contains his/her id number, Name and 3
subject marks. Implement a program to read N number of student records randomly and display the
student name and average, out of N number of students who got second highest average.
Define a structure called cricket that will describe the following information:
Player name, team name, batting average.
Using cricket, declare an array player with 50 elements and write a program to read the information
about all the 50 players and print a team wise list containing names of players with their team name.
Define a user defined data type student. The student structure contains student Id, Name, age, and 3
subject marks. Implement a program to read N number of student records and then arrange those
based on their average mark.
Define a user defined data type student. The student structure contains student Id, Name, course
name age, and 3 subject marks. Implement a program to read N number of student records and
display the average marks of each course.
Define a user defined data type student. The student structure contains student Id, Name, age, course
name and 3 subject marks. Implement a program to read N number of student records and display
the course name having highest course average.
Define a user defined data type student. The student structure contains student Id, Name, age, course
name and 3 subject marks. Implement a program to read N number of student records and display
the course name having lowest course average.
13
Question
Define Pointer. Differentiate Pointer variable and Ordinary variable. Explain the Operations on
Pointers with an Example Program.
Develop a program to read some text from the keyboard and store it in a file.
Distinguish the concept of Call-by-Value and Call-by-Reference.
Develop a program to copy one file into another. Copy one character at a time.
Develop a Program to Swap two integer variables by Passing pointers to a function and also explain
the concept of Call-by-value.
Develop a program to compare two files to check whether they are identical or not.
Explain the concept of passing Pointers to a Function and demonstrate with an example Program.
Develop a program to count the number of characters and number of lines in a file.
List the advantages of Pointers. Write a program to illustrate the concept of Pointer Arithmetic and
Pointer Expressions.
Develop a C language program to create file “odd” to store all odd numbers between 1 and n.
Develop a C language program to read “mark.dat” file containing rollno,name,marks of three subjects
and calculate total mark, result in grade and store same in “result.dat” file.
Develop a C language program to read a “cust.txt” file containing meter number ,name, current
reading & previous reading.Read the same file calculate unit and total amounts according to the
following rules—
Unit
rate
0-50
1.00
51-100 1.50
> 100
2.00
Store meter number ,name ,unit & amount in master.dat file.
Develop a program that takes the name of a file from the user, opens the file, reads through it to
determine the number of words in each sentence, displays the number of words and sentences, and
computes the average number of words per sentence.
Develop a C language program to read “mark.dat” file containing Student rollno, name, marks of three
subjects and calculate average mark, result in grade based on following rules Avg Marks > 80 then Grade = A
 Avg Marks between 61 & 80 then Grade = B
14
 Avg Marks between 51 & 60 then Grade = C
 Avg Marks between 41 & 50 then Grade = D
 Avg Marks between 35 & 40 then Grade = E
 Avg Marks <35 then ‘F’ (Fail)
and store the failed(F-grade) students rollno in “fail.dat” file.
Develop a C language program to read “mark.dat” file containing Student rollno, name, marks of three
subjects and calculate average mark, result in grade based on following rules Avg Marks > 80 then Grade = A
 Avg Marks between 61 & 80 then Grade = B
 Avg Marks between 51 & 60 then Grade = C
 Avg Marks between 41 & 50 then Grade = D
 Avg Marks between 35 & 40 then Grade = E
 Avg Marks <35 then ‘F’ (Fail)
and store the students rollno and grade in “result.dat” file.
Define a user defined data type student. The student structure contains student Id, Name, age,
Subject name and 3 subject marks. Implement a program to read N number of student records from
the user and store them in "stu.dat" file.
Develop a program to read "stu.dat" file containing student Id, Name, age, Subject name and 3 subject
marks and calculate average marks and store the student id and name whose average marks are
greater than 75 in "stu_Distinct.dat" file.
Develop a C language program to read “book.dat” file containing title, author name, ISBN number and
price. Then store title and price of the books in "Yaswant.dat" if the author name is yaswanth
Kanetkar.
Develop a C language program to read “book.dat” file containing title, author name, ISBN number and
price. Then store title and price of the books in "price.dat", if the price is less than Rs. 500.
Develop a C language program to read “book.dat” file containing title, branch name,author name,
ISBN number and price. Then store title and price of the books in "branch.dat", if the branch name is
CSE.
Develop a C language program to read “crick.dat” file containing Player name, team name and batting
average. Then store Player name, team name in "batavg.dat", if the batting average is greater than 30.
Develop a C language program to read “University.dat” file containing employee id, name,
Department, designation and salary. Then store employee id, name in "dept.dat", if the Department
name is CSE.
Develop a C language program to read “University.dat” file containing employee id, name,
Department, designation and salary. Then store employee id, name in "pof.dat", if the designation is
professor.
Develop a C language program to read “University.dat” file containing employee id, name,
Department, designation and salary. Then store employee id, sal in "sal.dat", if the salary is greater
than Rs.40000.
Develop a C language program to read “crick.dat” file containing Player name, team name and batting
average. Then store Player name, team name in "batavg.dat", if the batting average is greater than 30.
15