Experiment no.
2
Q1) WAP to take input of two numbers from the users and display
addition,subtraction,multiplication,and division for decimal.
Q2) WAP to take input of name,age,gender,city and height from the user and display in the
screen.
Q3) WAP to exchange two variables taken from the user without using a third variable.
Experiment no-3
Q1) WAP in C program to find greatest of two numbers using ternary operator.
Q2) WAP in C program to find greatest of three numbers using ternary operator.
Q3) WAP in C program to check whether the candidate is eligible for voting or not.
Experiment no. 4
Q1) WAP in C program to check whether the number is odd or even using if else function.
Q2) WAP in C program to find the largest of 3 numbers taking input from the user by using if
else function.
Q3) WAP in C program to find the factorial of a number and taking the input from the user by
using for loop function.
Q4) WAP in C program to find the factorial of a number and taking the input from the user by
using while loop function.
Q5) WAP in C program to find the factorial of a number and taking the input from the user by
using do-while loop function.
Q6) WAP to find day of week corresponding to the number input Taken from the user by using
switch case function.
Experiment no. 5
Q1) WAP to find the factorial of number as taking the input from the user by using function.
Q2) WAP in C to print the following pattern.
*
**
***
****
*****
Q3) WAP to print the simple calculator using function for each operation separately.
Q4) WAP to print Multiplication table of number taken from user.
Experiment no. 6
Q1) WAP to print the fibonacci Series.
Q2) WAP in C to print sum of digit of a numbers taken from user.
Experiment no. 7
Q1) WAP in C language to take input of 1-D array from the user and print it.
Q2) WAP in C to find smallest and largest number in 1-D array by taking the input from user and
display it.
Q3) WAP in C to sort 1-D array by using bubble sort and take input from user and display it.
Experiment no. 8
Q1) WAP To take an input in 2d array and display in the matrix form
Q2) WAP To take an input in 2d array and display its transpose in matrix form.
Q3) multiplication of matrix
Experiment number 9
Q1) WAP to swap two numbers using pointer
Q2) WAP to make tabular form of student Information like roll no,name and marks and arranging
the roll no in ascending order and searching student detail by roll no.
Experiment number 10
Q1) WAP to demonstrate the operation of open, write read and close a file.
Q2) WAP to copy the content of one file to another using file handling in C.
PYQ
2022
Q) write a c program to calculate the factorial of a number using function
#include <stdio.h>
int factorial(int n)
{
int i;
int x = 1;
for(i=1;i<=n;i++)
{
x=x*i;
}
printf("%d",x);
return x;
}
int main()
{
int number,fact;
printf("enter a number");
scanf("%d",&number);
factorial(number);
}
Q) write a program in c to create simple calculator by using switch cases
Q) Write a program to read 0 to 10 numbers from the user by using array and display average of
these numbers.
Q) Write A program in c for addition of two dimension matrices using multi dimensional array.
Q) Write a program in C to create a structure having names as student consisting of
name,address,student id as its members. Read the details of five students from the user and
then display the data eneterd by the user on screen (use array of structure)
Q) Write a program in C to create structure rectangle, constituting Of length and breadth as its
members.calculated and display area of rectangle.
2023
Q) wap to find the maximum number from 3 numbers entered by user.
Q) wap to create a simple calculator to perform addition, subtraction, division and multiplication
operation.
Q) wap to print area of square using function.
Q) How to program to print factorial of a given number using while loop and also write the
program using do while loop.
Q) wap To perform and to print the addition and subtraction of the two matrices.
Q) wap in c to create A structure Of student With fields such as student name,roll no,Amd marks
of two subject as its memebers. Calculate average of two subject. Read the details Of ‘n’
structure from the user and display the data in this format.
Roll no name sub1 sub2 total Average
Q) wap in c to craete a structure having named as books consist of title,author,subject,book and
as members. Read the details of five books from the user and then display the data entered by
the user on screen( use array of structure).
2022
Q) What will be output of the following program segment in C and
choose the correct option :
I) int a =-1 , b=1 ,c,d=2;
c= a++ + ++b - --d ;
printf(“a=%d b=%dc=%d d=%d”, c,a,b,d)
;
a) a=0 b=1 c=1 d= 1 b) a=-1 b= 0 c=1 d=1
c) a= 0 b= 0 c=2 d=1 d) a=0 b= 2 c= 0 d=1
II) int main()
{
char x='X';
char a= ++x + 1;
printf(“%c”, a);
printf("%d",a);
}
a) Z 90 b) 90 Z c) error d) none
III) # include < stdio.h>
int main()
{
int a=-2;
++a;
if ( a)
printf("Hi this is CPC ");
else
printf("C is Programming language ");
}
a) Hi this is CPC b) error c) C is Programming language d) None
Q)Write a Program to a read a number & display its reverse using while loop.
Q) write a program to accept two numbers & compute quotient and remainder display the same
Q)write a program to display folllowing pattern
*****
****
***
**
*
2019
Q) the length And breadth of a rectangle and radius of a circle are input through the keyboard.
Wap to calculate the area and and the perimeter of the rectangle And the area and
circumference of the circle.
Q) WAP to print the fibonacci Series up to the term Enterd by the user.
Q) wap to find the sum of 4 digit by using function.
Q) write a program to read and print 3d matrix.
Q) write a c program in c by using structure To store information of srptudent i.e name roll
number and marks and also display it.
2019
Q) suppose new generation of transport bus ( root mumbai to kolhapur) has no conductor in it,
and there is machine at the door of bus has functionality for ticket booking, in that there are four
options which indicates Stops of journey like 1-Panvel, 2 -Pune, 3-Satara, 4-Kolhapur.
Passenger have to enter appropriate choice, if no option chosen then it will consider Kolhapur
as default and book Ticket Accordingly.Write a program to develop such functionality.
Q) what will be the output if you will compile and execute the following code?choose the correct
option from given Below and justify your answer.
i) void main(){
int i=10;
static int x=i;
if(x==i)
printf("Equal");
else if(x>i)
printf("Greater than");
else
printf("Less than");
}
(A) Equal (B) Greater than (C) Less than (D) Compiler error (E) None of above
ii) void start();
void end();
#pragma startup start
#pragma exit end
int static i;
void main(){
printf("\nmain function: %d",++i);
}
void start(){
clrscr();
printf("\nstart function: %d",++i);
}
void end(){
printf("\nend function: %d",++i);
getch();
}
(A) main function: 2 (B) start function: 1. (C) main function: 2. (D) Compiler error
start function: 1. main function: 2. end function: 3
end function: 3. end function: 3. start function: 1. (E) None of these
Q) wap to identify, numbered Enterd by user Is even or odd.
2018
Q) wap by using switch statement to display monday to sunday.
Q) wap to show table of of a number using functions.
Q) Write a C program to swap two integer numbers by using different methods
The methods are:
i) Using third variable
ii) Without using third variable
iii) using XOR operator
Q) Write a program in C by using two dimesional array to store temperature of two cities for a
week and display it.
Q) Write a program in C to sort the numbers in decending order by taking input from the user.
Q) Write a program in C to create a structure of student with student name and rollno and marks
of two subjects as its members. Calculate average of two subjects. Read the details of n
students from user and then display the data in this format.
Roll No. Name Sub1 Sub2 Total Average
Q) What will be the output of the C program(assume size of int as 2 bytes)?
#include<stdio.h>
int main()
{
struct employee
{
int empid[5];
int salary;
employee *s;
}emp;
printf("%d %d", sizeof(employee), sizeof(emp.empid));
return 0;
}
A. 6 2
B. 14 10
C. 8 2
D. 12 10
ii) What will be the output of the C program?
#include<stdio.h>
struct decl
{
int n = 100;
}d1;
Int main()
{
Printf ( “%d”, d1.n);
return 0;
}
A.100
B.compilation error
C.0
D.garbage value