CS-4205 Programming and Problem Solving Using C
Implementation of C programming problems
M.Sc. (CS), M.Sc. (IT) , MCA SEMESTER I
SCHOOL OF COMPUTER SCIENCE & IT,
Main aim of this course is to understand and solve logical & mathematical problems through
C language and Flowchart. Strengthen knowledge of a procedural programming language. Design
and develop solutions to intermediate level problems using the C language. Further develop
your skills in software development using a procedural language.
The C language is a simple computer language designed to enable sophisticated object-
oriented programming. C is defined as a small but powerful set of extensions to the standard
ANSI C language. Its additions to C are mostly based on Smalltalk, one of the first object-
oriented programming languages. C is designed to give C full object-oriented programming
capabilities, and to do so in a simple and straightforward way.
Most object-oriented development environments consist of several parts:
An object-oriented programming language
A library of objects
A suite of development tools
A runtime environment
DESCRIPTION OF SCHEDULE:
WEEK PRACTICAL LIST Rema Ad
1-8 1. Write a C program to display "Hello Computer" on the screen.
Aug 2. Write a C program to display Your Name, Address and City in different
3. Write a C program to find the area of a circle using the formula: Area =
PI * r2
4. Write a C program to find the area and volume of sphere. Formulas are:
Area = 4*PI*R*R Volume = 4/3*PI*R*R*R.
5.Write a C program to print the multiply value of two accepted numbers
10-15 6. Write a C program to convert centigrade into Fahrenheit. Formula: C=
Write a C program to read in a three digit number produce following output
(assuming that the input is 347)
7. Write a C program to read in two integers and display one as a
percentage of the other. Typically your output should look like
20 is 50.00% of 40
8. assuming that the input numbers where 20 and 40. Display the
percentage correct to 2 decimal places.
9. Write a C program to find out whether the character presses through the
keyboard is a digit or not (using conditional operator).
10.Write a C program to swap variable values of i and j.
17-22 11. Write a C program to find the maximum from given three nos.
Aug 12.Write a C program to find that the accepted no is Negative, Positive or
13.Write a program which reads two integer values. If the first is lesser
print the message up. If the second is lesser, print the message down if
they are equal, print the message equal if there is an error reading the
data, print a message containing the word Error.
14.Write a C program that prints the given three integers in ascending
order using if – else.
15.Given as input three integers representing a date as day, month, year,
print the number day, month and year for the next day's date.
Typical input: “28 2 1992” Typical output: “Date following
28:02:1992 is 29:02:1992”.
24-29 16.Write a C program for calculator designing using switch /case loop?
Aug 17. Write a C program to convert decimal to binary.
18.Write a C program to convert decimal to octal.
19.Write a C program to convert decimal to hexadecimal.
20.Write a C program to find the sum of first 100 natural nos.
21.Produce a multiplication table. Top left hand corner will show 1x1 and
bottom right shows 12x12, as below.
1 2 3 4 5 6 7 8 9 10 11 12
2 4 6 8 10 12 14 16 18 20 22 24
3 6 9 12 15 18 21 24 27 30 33 36
4 8 12 16 20 24 28 32 36 40 44 48
5 10 15 20 25 30 35 40 45 50 55 60
6 12 18 24 30 36 42 48 54 60 66 72
7 14 21 28 35 42 49 56 63 70 77 84
8 16 24 32 40 48 56 64 72 80 88 96
9 18 27 36 45 54 63 72 81 90 99 108
10 20 30 40 50 60 70 80 90 100 110 120
11 22 33 44 55 66 77 88 99 110 121 132
12 24 36 48 60 72 84 96 108 120 132 144
22.Write a C program to find the sum of first 100 odd nos. and even nos.
31 Aug- 23.Write a C program to display first 25 Fibonacci nos.
5 Sept 24.Write a C program to display first 100 prime nos.
25.Write a C program to find factorial of accepted nos.
26.Write a C program to find the sum of digits of accepted no.
27.Write a program in C that will scan a number N and then output
the sum of the powers from 1 to N. thus, if the input is 4, the output
should be 288 bec. 1+4+27+256=288 [1,2,3,4]
28.Write a program in C that accepts dates written in numerical form and
then output them as a complete form.
Sample input: 2 26 1986
Sample output: February 26, 1986.
7-12 29.Write a C program to print the accepted no and its reverse no.
Sept 30.Write a C program to print all the Factors of accepted no.
31.Write a C program to find HCF of two given numbers.
32.Write a C program to find LCM of two given numbers.
33.Write a C program to find all the prime number between two given
34. The National Earthquake Information Center has the following criteria
to determine the earthquake damages. Here is
the given richter scale serve as an input data and the characterization as
RICHTER NUMBER (N)....CHARACTERIZATION
N<5.0---------little or no damage
14-19 35.Write C programs to print the terms of each of the following series:
Sept i. i. Sin(x) ii. Cos(x) iii. Log (1+x) iv. log(1-x) v. ex vi. e-x
36. Display the following output on screen (assuming the value for input
parameter n=5) :
a. b. c. d.
* 1 A 1
** 12 AB 23
*** 123 ABC 345
**** 1234 ABCD 4567
***** 12345 ABCDE 56789
21-26 a. b. c. d.
Sept ***** ABCDE * 1
**** ABCD *** 123
*** ABC ***** 12345
** AB ******* 1234567
* A ********* 123456789
f. g. h. i.
* ABCDE 1 *****
** ABCD 12 0000
*** ABC 123 ***
**** AB 1234 00
***** A 12345 *
k. l. m. n.
1 1 A ABCDEDCBA
01 22 AB ABCD DCBA
101 333 ABC ABC CBA
0101 4444 AB AB BA
10101 55555 A A A
28 Sept 37.Write a C program to find minimum, maximum, sum and average of the
-3 oct given one dimensional array.
38. Write a C program to perform the basic Matrix operations
addition, subtraction, multiplication, Transpose.
39.Write a program to take a sentence as input and reverse every word of
40.Write a C Function for the following task
42.Find value of a given Fibonacci term
43.Swapping the values of two variable
44.Minimum/maximum value from the given input
45.42. Print yesterdays date. You can use the ANSI standard functions
'time' and 'ctime'. An
46.example of the O/P from my program is.
47.Fri Mar 17 18:46:47 1995
5-10 oct 48. Write User Defined Function and test them in the main program for the
following standard function
a. int myatoi(Char *s)
b. char *myitoa(int i)
c. int mystrlen(char *s)
d. char *mysubstr(char *s, int i, int j)
e. char *mystrcat(char *s1,char *s2)
f. int mystrcmp(char *s1, char *s2)
g. int mystrchr(char *s, char c, int i)
h. char *mystrrev(char *s)
i. int mystrend(char *s, char *t)
j. char *myreplace(char *s, char *old, char *new)
k. int abs(int i)
l. char *mytoupper(char *)
m. char *mytolower(char*)
n. int isupper(char *s)
o. int islower(char *s)
p. int mypower(int a, int b)
int mymod (int a, int b)
12-17 49.Write the following recursive C Function
oct q. Factorial of a given number
r. Nth Fibonacci number
s. Reverse of a given String
t. Reverse of a give Number
19-24 50.Write a c program to create a new data type Date with the help of
oct structure and typedef. Also write following user defined function for
a. To return next Date,
b. To return next Month,
c. To return next Year,
d. To add few Days in a date
e. To add few Months in a date
f. To add few Years in a date
g. To return the date of the week of a given date.
h. To return Month name from the date.
i. To Display the Date in various format as: Date Display(Date d1, char
i. Here Date is the newly created data type. The format string can hold the
i. “DDMMYYYY”, “MMDDYY”, “MON, DD, YYYY”
51.Write a C program to implement myprintf and myscanf functions using
Concept of variable number of arguments.
52.(using getch, putch, gets and puts function)
53.Write a C program that creates an Employee text file? Records Are
empid, empname, designation, qualification, salary, experience,
Research work, address, city phone?
54.Write a C program that manipulates the above text file. The program
must implements the operation to modify a record, delete a record and
append new records.
26-31 55.Write C programs for the following operation to work like DOS
a. type abc.txt
b. copy source1.txt source2.txt
c. copy source1.txt source2.txt source3.txt source4.txt
d. compare source1.txt source2.txt
e. concat source1.txt source2.txt
56.Write a C program to open two files containing integers (in sorted
order) and merge their contents.
57.Write a C program to count the number of vowels, consonants, digits,
spaces, other symbols, words and lines in a given text file.
58.Write C code to check if an integer is a power of 2 or not
59.Write a C program to count bits set in an integer?
60.Write a C program to set a particular bit in a given number.
61.Write a C program to reset a particular bit in a given number.
2-7 Nov Revision and Tutorial
On completion of this module, the learner should be able to:
• Describe the syntax and semantics of the ANSI C programming language
• Explain the use of functions and function decomposition;
• Differentiate local variables from global variables, and state the scope of a variable;
• Work in a team to analyze engineering problems and develop C programs for solving
• Use the basic utilities and facilities for software development in a Unix operating
system environment to code,
• debug and test software;
• Investigate the core ANSI C language constructs required to implement C programs
• Develop a minor software in C language
Miss. Sarita Namdeo
Miss. Rakhi Mulchandani
Miss. Sushila Maravi
Mr. Kunal Khandvilkar
Miss. Ranu Runuwal
Miss Pritika Bahad