Saturday, September 11, 2021
Saturday, July 24, 2021
IMP Questions:
1)
Define Structure
and write a program to read and display 3 employee records with structure
2) Define Pointer; briefly explain about the pointer to pointer and pointer Arithmetic operations.
3) Briefly explain about the different types of File handling functions with examples
Numbers series and their sum
N terms of Natural numbers series and their sum ( 1^2+2^2 + 3^2+4^2+5^2 + 6^2 ..... n^2)
---------------------------------------------------------------------------------------------------
#include <stdio.h>
int main()
{
int i,n,sum=0;
printf("Input the number of terms in the series: \n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
sum+=(i)*(i); //main logic series generation
}
printf("\nSum of Series upto %d terms : %d \n",n,sum);
return 0;
}
------------------------------------------------------------------------------------------------
N terms of even numbers series and their sum ( 2^2 + 4^2 + 6^2 ..... n^2)
---------------------------------------------------------------------------------------------------
#include <stdio.h>
int main()
{
int i,n,sum=0;
printf("Input the number of terms in the series: \n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
sum+=(2i)*(2i); //main logic even no's generation
}
printf("\nSum of Series upto %d terms : %d \n",n,sum);
return 0;
}
--------------------------------------------------------------------------------------------------
N terms of odd numbers series and their sum ( 1^2 + 3^2 + 5^2+7^2 ..... n^2)
-----------------------------------------------------------------------------------------------
#include <stdio.h>
int main()
{
int i,n,sum=0;
printf("Input the number of terms in the series: \n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
sum+=(2i-1)*(2i-1); //main logic odd number generation
}
printf("\nSum of Series upto %d terms : %d \n",n,sum);
return 0;
}
Triangle Display
^^^^^ Number Triangle Display ^^^^^
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
---------------------------------------------------------------------------------
#include<stdio.h>
void main()
{
int i,j;
printf("Triangle Display \n");
for(i=1;i<10;i++)
{
for(j=1;j<=i;j++)
{
printf("%d\t",j);
}
printf("\n");
}
}
*************************************************
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
**************************************************
#include<stdio.h>
void main()
{
int n,i,j;
clrscr();
printf("Enter the no of lines required: \n");
scanf("%d",&n);
for(i=n;i>0;i--)
{
for(j=1;j<=i;j++)
{
printf("%d\t",j);
}
printf("\n");
}
}
Star Triangle Program
^^^^^^^^^^^^^Triangle Display^^^^^^^^^^^^^^^
*
* *
* * *
* * * *
* * * * *
---------------------------------------------------------------------------------
#include<stdio.h>
void main()
{
int i,j;
printf("Triangle Display \n");
for(i=1;i<10;i++)
{
for(j=1;j<=i;j++)
{
printf("*\t");
}
printf("\n");
}
}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* * * * *
* * * *
* * *
* *
*
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#include<stdio.h>
void main()
{
int n,i,j;
clrscr();
printf("Enter the no of lines required: \n");
scanf("%d",&n);
for(i=n;i>0;i--)
{
for(j=1;j<=i;j++)
{
printf("* \t");
}
printf("\n");
}
}
Friday, July 23, 2021
To display the n terms of harmonic series and their sum. 1 + 1/2 + 1/3 + 1/4 + 1/5 ... 1/n terms.
#include <stdio.h>
int main()
{
int i,num1;
float num2=0;
printf("Input the number of terms in the series: \n");
scanf("%d",&num1);
for(i=1;i<=num1;i++)
{
if(i<=num1)
{
printf("1/%d + ",i);
num2+=1/(float)i;
}
}
printf("\nSum of Series upto %d terms : %f \n",num1,num2);
return 0;
}
OUTPUT:
Input the number of terms in the series:
5
1/1 + 1/2 + 1/3 + 1/4 + 1/5
Sum of Series upto 5 terms : 2.283334
Input the number of terms in the series:
10
1/1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6 + 1/7 + 1/8 + 1/9 + 1/10
Sum of Series upto 10 terms : 2.928968
Armstrong number
Armstrong number is a number that is equal to the sum of cubes of its digits. For example 0, 1, 153, 370, 371 and 407 are the Armstrong numbers.
Let's try to understand why 153 is an Armstrong number.
153 = (1*1*1)+(5*5*5)+(3*3*3)
where:
(1*1*1)=1
(5*5*5)=125
(3*3*3)=27
1+125+27=153 it is an Armstrong number
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#include<stdio.h>
int main()
{
int n,r,sum=0,temp;
printf("enter the number=");
scanf("%d",&n);
temp=n;
while(n>0)
{
r=n%10;
sum=sum+(r*r*r);
n=n/10;
}
if(temp==sum)
printf("armstrong number ");
else
printf("Given number is not a armstrong number");
return 0;
}
OUTPUT:
enter the number=371
armstrong number
enter the number=45
Given number is not a armstrong number
To find transpose of a given matrix
#include<stdio.h>
int main()
{
int mat[10][10];
int i,j,r,c;
printf("Enter number of Rows :");
scanf("%d",&r);
printf("Enter number of Cols :");
scanf("%d",&c);
/*-------------------------------------------------------------------------*/
printf("\nEnter matrix elements :\n");
for(i=0;i< r;i++)
{
for(j=0;j< c;j++)
{
scanf("%d",&mat[i][j]);
}
}
/*-------------------------------------------------------------------------*/
/*Transpose a matrix */
printf("\nTranspose Matrix is : \n");
for(i=0;i< c;i++)
{
for(j=0;j< r;j++)
{
printf("%d\t",mat[j][i]);
}
printf("\n");
}
return 0;
}
-------------------------------------------------------------
OUTPUT1:
Enter number of Rows :2
Enter number of Cols :2
Enter matrix elements :
1
2
3
4
Transpose Matrix is :
1 2 1 3
3 4 ==> 2 4
Multiplication of two square Matrices
m×n n×q = m×q
Thursday, July 15, 2021
PPSUC UNITWISE QUESTIONS
UNIT-1
1)
Convert the given Decimal number (125)10 into Binary, Octal, Hexa decimal number system
2)
Convert the given Binary number (101011)2 into Decimal, Octal, Hexa decimal number system
3)
Convert the given Octal number (31)8 into Binary, Decimal, Hexa decimal number system
4)
Convert the given Hexadecimal number (19)16 into Decimal, Octal, Binary number system
5)
Briefly explain the different types of data types
6)
Briefly explain the differences between the
variable and constant with a sample programs
7)
Briefly explain different types of Storage Classes
8)
What is local scope and global scope explain with a
program.
9)
What is an Expressions, and explain the Precedence and Associativity rules with some
examples
10) What is the
need of Type Conversion Statements explain with examples programs
11)
What is Command Line Arguments and write a program
to add two numbers using command line arguments.
12)Briefly explain
about the Type Qualifiers with a programming example.
UNIT-2
1)
Briefly explain the different types of operators
with examples.
2)
What are the Bitwise operators explain with examples.
3)
Briefly different types of Conditional statements
with sample programs
4)
Write a Program to demonstrate the calculator with Switch
Case.
5)
Briefly explain about the Pre-test loop and
Post-test loops with a sample program to find the given number is Palindrome or
not
6)
Demonstrate the Nested conditional statements with a
program
7)
Demonstrate the Nested looping statements with a
program.
8)
Briefly explain the unconditional statements Break,
Continue, goto
9)
Demonstrate the shift operators with program
10)Demonstrate the
use of Switch case with a program.
UNIT-3
1)
Briefly explain different types of arrays and write
a program to perform the addition of two matrices.
2)
Define string and briefly explain the different
types of string manipulation functions with examples
3)
What is Enum, explain with a program.
4)
Define Type def, explain with a program.
5)
Define Structure and write program to read 3
students records and display with structures.
6)
Define Union and write program to read 3 students
records and display with structures.
7)
Briefly explain about the Nested structures with a
program
8)
Demonstrate the Array of Structures.
9)
Briefly explain about the differences between the
Structures and Unions
10)Write a C program
to demonstrate the Employee data using Unions.
11)
1.Briefly explain the following with a sample
program
A)
Enumeration
B) Structure
C) Union
D) Typedef
UNIT-4
1)
Define Pointer and write a program to demonstrate
the use of a pointer variable.
2)
Briefly explain different types Dynamic Memory
Allocation functions.
3)
Define pointer to pointer with program
4)
What is pointer compatibility explain with an example
5)
What is L-values, R-value demonstrate with example.
6)
Demonstrate Array of pointer with a program
7)
What is pointer to array explain with a program.
8)
Define different types Processor Commands with
examples
9)
What is Macro explain with a sample program.
10)What is pointer
arithmetic operation explain with example.
UNIT-5
1) Briefly explain
different type’s functions with examples and Write a program to swap two
numbers with call by reference.
2) Briefly explain about function call by values with a
program.
3) What is inter function communication, explain with examples.
4) Demonstrate Passing Array to Functions with a program.
5) Demonstrate Passing Pointers to Functions with a program.
6) Briefly explain different types of File handling functions
in C
7) What do you mean by Recursion? Write a program to find
factorial of given
number using recursion.
8) Differentiate between user defined functions and
pre-defined functions. Also
explain the purpose of function prototype.
9) Write a C program to copy the contents of one file to
another file.
10)Write a C program to merge two files into a single file
Monday, June 14, 2021
Monday, June 7, 2021
Thursday, May 20, 2021
Tuesday, May 11, 2021
Wednesday, April 28, 2021
Friday, April 23, 2021
PPSUC LAB EXAM SAMPLE QUESTIONS
1)a)Write a C program to convert a string to a long integer
b)Write a program in C which is a Menu-Driven Program to compute the area of the various geometrical shape
2)a)Write a program in C to swap numbers using call by reference.
b)Write a program in C to sort elements of array in ascending order.
3)a) Write a C program to demonstrate the Nested Structures
b) Write a Program to demonstrate the use of pointer to pointer variable.
4)a)Write a C program to demonstrate the array of structures
b)Write a program to find the factorial of the given number using recursive function call
5)a)Write a C program to compute the perimeter and area of a rectangle with a height of 7 Inches and width of 5 inches
b)Write a C program to check whether a given number is an Armstrong number or not.
6)a)Write a C program that accepts 4 integers p, q, r, s from the user where r and s are positive and p is even. If q is greater than r and s is greater than p and if the sum of r and s is greater than the sum of p and q print "Correct values", otherwise print "Wrong values".
b)Write a program in C to find transpose of a given matrix
7)a) Write a C Program to print contents of file
b) Write a C program to add two matrix of the size 2X2.
8)a) Write a C program to check whether a given number is an Armstrong number or not.
b) Write a program in C to swap numbers using call by reference.
9)a) Write a program in C to add two numbers using pointers.
b) Write a program to read & display the student data using structure
10)a)Write a C program to write some text to a text file
b)Write a program to read & display the student data using UNION
Friday, February 26, 2021
Monday, January 18, 2021
PROGRAMMING FOR PROBLEM SOLVING USING C_R20_SYLLABUS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Course Objectives: