0% found this document useful (0 votes)
259 views4 pages

C Lab Sheet

This document contains 13 lab sheets for a Computer Programming I course. It outlines programming assignments for students to complete covering topics like input/output, operators, conditional statements, loops, functions, arrays, strings and structures. The assignments include writing programs to calculate math problems, analyze characters, sort and manipulate data, and work with arrays, strings and structures. Students are asked to write code that displays output, performs calculations, analyzes input and manipulates data based on the assigned tasks.

Uploaded by

Ramesh Shrestha
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
0% found this document useful (0 votes)
259 views4 pages

C Lab Sheet

This document contains 13 lab sheets for a Computer Programming I course. It outlines programming assignments for students to complete covering topics like input/output, operators, conditional statements, loops, functions, arrays, strings and structures. The assignments include writing programs to calculate math problems, analyze characters, sort and manipulate data, and work with arrays, strings and structures. Students are asked to write code that displays output, performs calculations, analyzes input and manipulates data based on the assigned tasks.

Uploaded by

Ramesh Shrestha
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1/ 4

Kantipur City College, BE Computer 1st Semester Computer Programming I

LAB SHEET 1
1. Write a program to display name of your college by using printf() function.
2. Write a program to display name, address and phone by using '\t' in printf()
function.
3. Write a program to display name, address and phone by using '\n' in printf()
function.
LAB SHEET 2
1.
2.
3.
4.

Write a program to read two integers and calculate sum, difference and product.
Write a program to calculate the simple interest.
Write a program to calculate the cube of (a+b).
Write a program to ask the user for the radius of a circle and calculate the area and
circumference.
5. Write a program to convert the temperature value given in Celsius to Fahrenheit.
6. Write a program to enter a character in lower case and convert it upper case and
vice versa.(using toupper() & tolower() functions and without using functions)
LAB SHEET 3
1. Write a program to input two integer numbers and find quotient and remainder.
2. Write a program to find the addition, subtraction, multiplication, division and
modulo of given two integer input using shorthand assignment operator.
3. Write a program to find the reverse of three digit integer number.
4. Write a program to find the greatest number among two given by the user using
ternary operator.
5. Write a program to input two integer numbers a and b, compare them, if a is
greater than b add 2 to a else add 3 to b using ternary operator.
LAB SHEET 4
1. Write a program to find the odd or even number using if else statement.
2. Write a program to find the largest of three integer numbers using nested if
statement.
3. Write a program to prints the day depending upon the number inputted by the user
using else if ladder.
4. Write a program to prints the day depending upon the number inputted by the
user. (using switch case)
5. Write a program to calculate sum, difference, multiple, division of two numbers.
[Design menu and use switch case.]
6. Write a program to print the numbers from 10 & 30 by using goto statement.
7. Write a program to find the vowel and consonant of a given character. [Using IF
statement.]
8. Write a program to find the given character is alphabet or numeric. If alphabet
then check uppercase or lower case, if in lower case then convert it into upper and
vice-versa.

Kantipur City College, BE Computer 1st Semester Computer Programming I

LAB SHEET 5
1. Write a program to find the sum of number from 1 to 50.
2. Write a program to enter any digit integer number, reverse it and check whether it
is palindrome or not. ( Use while() loop)
3. Write a program to enter an integer number and check whether it is Armstrong or
not.
4. Write a program to check whether a user inputted number is perfect or not.
5. Write a program to find sum of even numbers from 2 to 100.
6. Write a program to calculate the value of x to the power y.
7. Write a program to generate FIBONACCI number up to nth position
8. Write a program to print the factorial of number (n) entered from keyboard.
9. Write a program that checks given number is prime or not.
10. Write a program to generate multiplication table from 1 to 10.
LAB SHEET 6
1. Write a program to accept any number 'n' and print the sum of square of all
numbers from 1 to n.
2. Write a program to display the Armstrong number from 100 to 200.
3. Write a program to enter the value of n1 and n2 and find and display the prime
number between n1 and n2.
4. Write a program to generate the following output:
a.
b.
c.
1
22
333
4444
55555

*
**
***
****
*****
d.

12345
1234
123
12
1

e.

11111
2222
333
44
5

1
2 3
4 5 6
7 8 9 10
f.

1
12
123
1234
12345

LAB SHEET 7
1. Write a program to accept any number 'n' & print the cube of all numbers from
1to n which is exactly divisible by 3.
2. Write a program to find the leap year between 1900 and 2000..
3. Write a program to display following output:

Kantipur City College, BE Computer 1st Semester Computer Programming I

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
LAB SHEET 8
1. Write a program to enter values in array called myarray of size 15 and display the
elements of array.
2. Write a program to enter values in array called myarray of size 10 and display the
sum of elements of array.
3. Write a program to find the largest and smallest value in array.
4. Write a program to sort the number in ascending order.
5. Write a program to add the numbers in two arrays and assign in next array.
LAB SHEET 9
1. Write a program to evaluate to following polynomial equation.
p(x)=a0x^o+a1x^1+a2x^2+...........a(n-1)x(n-1)^(n-1)+anx^n
2. Write a program to transpose the matrix.
3. Write a program to add two matrix called matrix_a and matrix_b and put the
result in matrix_c.
Write a program to find the product of two matrices
LAB SHEET 10
1. Write a program to generate FIBONACCI number up to nth position. Using
function.
2. Write a program to ask the user for two numbers and print the sum, difference and
product of two numbers.
a. Function without argument, without return type.
b. Function with argument, without return type.
c. Function with argument, with return type.
d. Function without argument, with return type.
3. Write a program to read two integers a and b and calculate (a+b)^3 using
function.
4. Write a program to calculate the factorial of a given number using function
declaration.
. LAB SHEET 11
1. Write a program to read the string from the user and display its length.(using
strlen() and without using strlen())
2. Write a program to enter a string and copy it to another string .( using strcpy()
and without using strcpy())

Kantipur City College, BE Computer 1st Semester Computer Programming I

3. Write a program to enter two string and compare them to check whether they
are same or not.(using strcmp() and without using strcmp()).
4. Write a program to enter two string and concatenate one string to
another(using strcat() and without using strcat());
5. Write a program to enter a string reverse it and check whether it is palindrome
or not.
6. Write a program to sort the 10 strings in alphabetical order.
7. Write a program to find the longest string among 10 strings.
8. Write a program to display the first and last character of 5 strings.
LAB SHEET 12
1.
2.
3.
4.

Write a program to clear the concept of swapping call by reference.


Write a program to accept 10 numbers and print the total with the use of pointer.
Write a program to test the word palindrome or not.
Create a structure called employee with suitable members. Write a program to
ask the value for structure members and short them with the basis of salary.(use
pointer for all operation)
5. Write a program to allocate the memory (memory size should given by the user)
for numbers given by the user and sort them with the use of pointer
LAB SHEET 13
1. Program to define a structure struct personal that would contain person name,
address, phone number, date of joining and salary. WAP to read this information
for one person from the keyboard & print the same on the screen.
2. Program to define a structure 'Student',that describes attributes like 1.char
firstname[20], 2. char lastname[20], 3. int rollno, & 4. float persentage. using this
structure, declare array of 3 student & WAP to read the information about each
student & calculate the average percentage.
3. A point has x-axis & y-axis. Define a struct called point with suitable attribute.
WAP to accepts two points from the user & calculate the distance between the two
points [d=sqrt((x2-x1)^2+(y2-y1)^2)]
4. Program to define a structure called 'Time' with suitable members, and read two
times from user and perform addition between these times.
.

You might also like