PPS Practical
PPS Practical
ANDREWS INSTITUTE
OF TECHNOLOGY & MANAGEMENT
Gurgaon Delhi (NCR)
Approved by AICTE, Govt. of India, New Delhi Affiliated to
Maharshi Dayanand University
‘A’ Grade State University, accredited by NAAC
Bachelor of Technology
CSE-103G
Program:-
#include <stdio.h>
int main() {
char name[] = "Dinesh Kumar";
char rollNo[] = "247001";
char fathersName[] = "Samer Singh";
char address[] = "Bhiwani Hyaryana";
char phone[] = "+91 8950932595";
char email[] = "work.dinesh@gmail.com";
char dob[] = "07/04/2004";
char education[] = "Pursuing B.Tech in CSE with
specialization in AI/ML";
char skills[] = "C, Python, JavaScript, HTML5, CSS3";
char hobbies[] = "Music, Finance, Traveling, Coding,
Volleyball";
// Print bio-data
printf(" BIO-DATA \n");
printf("============================================\n");
printf("Name: %s\n", name);
printf("Father's Name: %s\n", fathersName);
printf("Address: %s\n", address);
printf("Phone: %s\n", phone);
printf("Email: %s\n", email);
printf("Date of Birth: %s\n", dob);
printf("Education: %s\n", education);
printf("Skills: %s\n", skills);
printf("Hobbies: %s\n", hobbies);
printf("============================================\n");
return 0;
}
Output:-
Practical-2:- The distance between two cities (in kms) is input through the
keyboard. Write a program to convert and print this distance in
meters, feet, inches and centimeters.
Program:-
#include <stdio.h>
int main()
{
char name[] = "Dinesh kumar";
char rollNo[] = "247001";
float distance_km;
const float km_to_m = 1000.0;
const float km_to_feet = 3280.84;
const float km_to_inches = 39370.1;
const float km_to_cm = 100000.0;
Output:-
Practical-3:- Consider a currency system in which there are notes of seven
denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. If
the change given to Pranav Rs. N is input, write a program to
compute smallest number of notes that will combine to give Rs. N.
Program:-
#include <stdio.h>
int main() {
// Print the name and roll number
printf("Name: Dinesh kumar\n");
printf("Roll Number: 247001\n\n");
int N;
printf("Enter the amount (Rs. N): ");
scanf("%d", &N);
return 0;
}
Output:-
Practical-4:- Ram is watching the children playing in a park. He wants to write a
program that will get height of a child from the user and decide
whether the child is
normal, tall, or short based on the below criteria:-
#include <stdio.h>
int main()
{
char name[] = "Dinesh Kumar";
char rollNo[] = "247001";
float height;
return 0;
}
Output:-
Practical-5:- Write a C program to print the following pattern.
1
11
121
1331
1464
1
Program:-
include
<stdio.h> int
main() {
return 0;
}
Output:-
Practical-6:- Write a program to display all the factors of the given number.
Program:-
#include <stdio.h>
int main()
{
char name[] = "Dinesh";
char rollNo[] = "247001";
int number;
Program:-
#include <stdio.h>
int main()
{
char name[] = "Dinesh Kumar";
char rollNo[] = "247001";
return 0;
}
Output:-
Practical-8:-Write a program to find location of an element in 1-D array.
Program:-
#include <stdio.h>
int main()
{
int array[] = {10, 20, 30, 40, 50};
int size = sizeof(array) / sizeof(array[0]);
int target;
if (location != -1)
{
printf("Element %d found at index %d.\n", target,
location);
}
else
{
printf("Element %d not found in the array.\n",
target);
}
return 0;
}
Output:-
Practical-9:- Write a program to do matrix addition of two matrices input
by user of dimensions 3*4
Program:-
#include <stdio.h>
int main() {
// Performing addition
for (i = 0; i < 3; i++) {
for (j = 0; j < 4; j++) {
sum[i][j] = matrix1[i][j] + matrix2[i][j];
}
}
// Result
printf("\nResultant matrix after addition:\n");
for (i = 0; i < 3; i++) {
for (j = 0; j < 4; j++) {
printf("%d ", sum[i][j]);
}
printf("\n");
}
return 0;
}
Output:-
Practical-10:- Write a program to implement any 6 inbuilt string functions in
C on given input string.
Program:-
#include <stdio.h>
#include <string.h>
int main()
{
return 0;
}
Output:-
$ practical_
Practical-11:- Write a program to reverse the given input string without
using string functions.
Program:-
#include <stdio.h>
int main() {
return 0;
}
Output:-
Practical-12:- Write a C program to implement a function to print upto the
nth Fibonacci element in the series using recursion.
Program:-
#include <stdio.h>
int main()
{
char name[] = "Dinesh Kumar";
char rollNo[] = "247001";
if (n <= 0)
{
printf("Please enter a positive integer.\n");
}
else
{
printFibonacciSeries(n);
}
return 0;
}
Output:-
Practical-13:- Write a C program to find:
a. the square root of a number using the sqrt() function
b. the log value using log() function
c. the power using pow() function
Program:-
#include <stdio.h>
#include <math.h> // Required for sqrt(), log(), and pow()
int main()
{
char name[] = "Dinesh kumar";
char rollNo[] = "247001";
// c. Power of a number
printf("\nEnter the base number: ");
scanf("%lf", &base);
printf("Enter the exponent: ");
scanf("%lf", &exponent);
printf("%.2lf raised to the power of %.2lf is %.2lf\n",
base, exponent, pow(base, exponent));
return 0;
}
Output:-
Program For I :-
#include <stdio.h>
int main()
{
";
return 0;
}
Program For II :-
#include <stdio.h>
int main()
{
return 0;
}
Program:-
#include <stdio.h>
#include <string.h>
int main()
{
Output:-
Practical-16:- Write a program to read a text file and display its contents in
C.
Program:-
#include <stdio.h>
int main()
{
return 0;
}
Output:-