Podcast
Questions and Answers
In a simple calculator program, the result of adding two numbers is calculated using ______.
In a simple calculator program, the result of adding two numbers is calculated using ______.
addition
When dividing two numbers, if the second number is ______, an error will occur.
When dividing two numbers, if the second number is ______, an error will occur.
zero
The program checks if a number is an ______ number or not as part of its functionality.
The program checks if a number is an ______ number or not as part of its functionality.
Armstrong
To calculate the square of a number in the program, the formula used is ______ multiplied by itself.
To calculate the square of a number in the program, the formula used is ______ multiplied by itself.
Signup and view all the answers
In the calculator program, the user is prompted to enter their choice through ______.
In the calculator program, the user is prompted to enter their choice through ______.
Signup and view all the answers
The academic year for the 24ESPL101 - PROGRAMMING IN C Laboratory is ____.
The academic year for the 24ESPL101 - PROGRAMMING IN C Laboratory is ____.
Signup and view all the answers
The first experiment involves using I/O statements and ____.
The first experiment involves using I/O statements and ____.
Signup and view all the answers
One of the experiments focuses on checking for a ____ year.
One of the experiments focuses on checking for a ____ year.
Signup and view all the answers
The algorithm for displaying values using data types starts with 'Start the ____.'
The algorithm for displaying values using data types starts with 'Start the ____.'
Signup and view all the answers
The staff in-charge and head of the department certify the ____ record of the work done.
The staff in-charge and head of the department certify the ____ record of the work done.
Signup and view all the answers
One of the practices includes finding the ____ of a given number.
One of the practices includes finding the ____ of a given number.
Signup and view all the answers
A C program can be written to find the ____ of a character in a string.
A C program can be written to find the ____ of a character in a string.
Signup and view all the answers
The course includes file operations and managing student information using an ____ of structures.
The course includes file operations and managing student information using an ____ of structures.
Signup and view all the answers
The program checks if a number is positive, negative, or ______.
The program checks if a number is positive, negative, or ______.
Signup and view all the answers
To check the greatest among two numbers, the program uses an if ______ statement.
To check the greatest among two numbers, the program uses an if ______ statement.
Signup and view all the answers
In the first program, the variable used to hold the user's number is called ______.
In the first program, the variable used to hold the user's number is called ______.
Signup and view all the answers
The variables declared to compare two numbers are ______ and y.
The variables declared to compare two numbers are ______ and y.
Signup and view all the answers
The output of the program indicates whether the number is POSITIVE, NEGATIVE, or ______.
The output of the program indicates whether the number is POSITIVE, NEGATIVE, or ______.
Signup and view all the answers
To check the greatest among three numbers, the program uses ______ if-else statements.
To check the greatest among three numbers, the program uses ______ if-else statements.
Signup and view all the answers
The first step in the algorithm to find the greatest among two numbers is to ______ the program.
The first step in the algorithm to find the greatest among two numbers is to ______ the program.
Signup and view all the answers
To input a number, the program uses the ______ function.
To input a number, the program uses the ______ function.
Signup and view all the answers
Step 2 Get the ______
Step 2 Get the ______
Signup and view all the answers
If the year Modulo 4 equal to 0 and Modulo ______ not equal to 0.
If the year Modulo 4 equal to 0 and Modulo ______ not equal to 0.
Signup and view all the answers
Check if the year Modulo ______ equal to 0
Check if the year Modulo ______ equal to 0
Signup and view all the answers
If YES print ______ year
If YES print ______ year
Signup and view all the answers
Step 2 Display the menu with options for ______, subtraction, multiplication, division, and square.
Step 2 Display the menu with options for ______, subtraction, multiplication, division, and square.
Signup and view all the answers
If the user selects ______ (option 1):
If the user selects ______ (option 1):
Signup and view all the answers
If the divisor is not zero, calculate the ______.
If the divisor is not zero, calculate the ______.
Signup and view all the answers
Step 9 ______
Step 9 ______
Signup and view all the answers
If a > b go to step ______ Otherwise go to step 5
If a > b go to step ______ Otherwise go to step 5
Signup and view all the answers
If a > c then print '______ is greatest' Otherwise print c is greatest
If a > c then print '______ is greatest' Otherwise print c is greatest
Signup and view all the answers
To write a C program to check a given number is divisible by both 5 and ______ using else if ladder statement.
To write a C program to check a given number is divisible by both 5 and ______ using else if ladder statement.
Signup and view all the answers
If a%5 == 0 && a%8 == 0 then print 'Divisible by both 5 and ______'
If a%5 == 0 && a%8 == 0 then print 'Divisible by both 5 and ______'
Signup and view all the answers
Step ______: If a%8 == 0 then print 'Divisible by 8' Otherwise go to step 5
Step ______: If a%8 == 0 then print 'Divisible by 8' Otherwise go to step 5
Signup and view all the answers
Else if a%5 == 0 then print 'Divisible by ______'
Else if a%5 == 0 then print 'Divisible by ______'
Signup and view all the answers
Thus a C program using decision making constructs to check a given number is ______ by both 5 and 8 has been executed successfully.
Thus a C program using decision making constructs to check a given number is ______ by both 5 and 8 has been executed successfully.
Signup and view all the answers
The program checks if a given number is an ______ number.
The program checks if a given number is an ______ number.
Signup and view all the answers
The user is prompted to enter a three-digit ______.
The user is prompted to enter a three-digit ______.
Signup and view all the answers
The formula used to check Armstrong is by calculating the ______ of each digit.
The formula used to check Armstrong is by calculating the ______ of each digit.
Signup and view all the answers
In the second program, if the number is divisible by ______, it is even.
In the second program, if the number is divisible by ______, it is even.
Signup and view all the answers
The variable ______ is used to check if a number is odd or even.
The variable ______ is used to check if a number is odd or even.
Signup and view all the answers
If a number is not divisible by two, it is considered an ______ number.
If a number is not divisible by two, it is considered an ______ number.
Signup and view all the answers
The final output confirms whether the input number is an ______ or even.
The final output confirms whether the input number is an ______ or even.
Signup and view all the answers
To find the factorial of a number, a variable named ______ is used.
To find the factorial of a number, a variable named ______ is used.
Signup and view all the answers
Study Notes
Course Information
- Institution: Sai Ram Engineering College
- Department: Mechanical Engineering
- Batch: 2024-2028
- Semester: First
- Course: Programming in C Laboratory
- Academic Year: 2024-2025
- Course Code: 24ESPL101
Laboratory Experiments
-
Experiment 1: I/O statements and expressions
- Aim: To write a C program to display values using data types.
- Algorithm: Start, declare int, float, char variables, get input values, display values, stop.
- Program: Includes <stdio.h>, declares integer, float, and character variables. Prompts the user to enter integer, float, and string values, reads the input values using scanf, prints the input values using printf.
-
Experiment 2: Evaluate area of a triangle
- Aim: To evaluate the area of a triangle using the Heron's formula.
- Algorithm: Start, input sides (a, b, c), calculate semi-perimeter (s), calculate area (area = sqrt(s * (s - a) * (s - b) * (s - c))), print area, stop.
- Program: Includes <stdio.h> and <math.h>, declares integer variables for sides (a, b, c) and float variables for semi-perimeter (s) and area (area). Prompts the user to enter the values of a, b, and c, reads the input values using scanf, calculates the area using the Heron's formula, and prints the calculated area using printf.
-
Experiment 3: Check positive, negative or zero
- Aim: To check whether a given number is positive, negative, or zero using if-else statements.
- Algorithm: Start, input number, check if number > 0 (positive), number < 0 (negative), otherwise (zero), print result, stop.
- Program: Includes <stdio.h>, declares an integer variable (num), gets input, uses if-else statements to determine whether the number is positive, negative, or zero and prints the result.
-
Experiment 4: Greatest among two numbers
- Aim: To find the greatest between two numbers using if-else statement.
- Algorithm: Start, input two numbers (x and y), compare x and y, if x > y print x is greater, else if x < y print y is greater, else print x and y are equal, stop.
- Program: Includes <stdio.h>, declares integer variables (x and y), gets inputs, uses if-else statements to compare the values and print the largest number.
-
Experiment 5: Greatest among three numbers
- Aim: To determine the greatest among three numbers using nested if-else.
- Algorithm: Start, input three numbers (a, b, c), use nested if-else to compare and identify the largest, print result, end.
- Program: Includes <stdio.h>, declares integer variables (a, b, c), gets inputs, uses nested if-else to compare the values and prints the largest number.
-
Experiment 6: Check divisibility
- Aim: To check if a number is divisible by 5 or 8, or both, using else if ladder.
- Algorithm: Input a number, check divisibility by 5, then by 8, print result; end.
- Program: Includes <stdio.h>, declares integer variable (a), gets input, uses if-else-if ladder to check divisibility rules and prints corresponding results.
-
Experiment 7: Find Factorial
- Aim: To calculate a factorial of a given number.
- Algorithm: Start, input number, calculate factorial, display factorial, end.
- Program: Includes <stdio.h>, declares integer variable (num), long variable (fact), calculate factorial using for loop, display result.
-
Experiment 8: Find Average of 4 numbers
- Aim: To calculate the average of 4 integers.
- Algorithm: Input 4 numbers, calculate the sum, divide by 4, print the average, end.
- Program: Includes <stdio.h>, declares integers for input numbers (num), sum, and average; calculates sum and average.
-
**Experiment 9: Print half pyramid of * **
- Aim: To print a half pyramid of asterisks.
- Algorithm: Start, input number of rows, loop for each row, print asterisks increasing each row, end.
- Program: Includes <stdio.h>, Takes input from user of number of rows, prints based on rows using nested for loops.
-
Experiment 10: Display array elements
- Aim: To display array elements in a 2D array
- Algorithm: Declare a two-dimensional array, take input values into the array, and print elements.
- Program: Includes <stdio.h>, declares 2D integer array, Takes input element in each row/column using nested for loops, print elements in a formatted manner
-
Experiment 11: Perform swapping
- Aim: To swap two numbers using a function.
- Algorithm: Start, input two numbers, call a swap function which swaps the numbers, display swapped values, stop.
- Program: Includes <stdio.h>, declares integer variables a, b and temporary variable for swapping. Takes input from user, calls the function to swap the values, displays result using printf.
-
Experiment 12: Generate prime numbers
- Aim: To display all prime numbers between two intervals using a function.
- Algorithm: Input two numbers, loop through the numbers between the intervals using for loop, if prime print number, end.
- Program: Includes <stdio.h>, declares integer variables for input numbers, use a user defined function to check for prime numbers using for loop.
-
Experiment 13: Solve Towers of Hanoi
- Aim: To solve Tower of Hanoi using recursion.
- Algorithm: Start, Use recursion function, execute the function, end.
- Program: Includes <stdio.h>, has recursive function to move disks from one rod to another via auxiliary rod.
-
Experiment 14: Largest element in an array
- Aim: To find the largest element in an array using a function.
- Algorithm: Input size of array and elements using a for loop, call a user-defined function to find largest, print largest element, end.
- Program: Includes <stdio.h>, takes input, has a user defined function to find largest element.
- Aim: To find the largest element in an array using a function.
-
Experiment 15: Concatenate two strings
- Aim: To concatenate two strings.
- Algorithm: Get the length of the first string, concatenate the second string to the end, display the concatenated string, end.
- Program: Includes <stdio.h>, takes two strings as input, calculates length using a while loop. Concatenates them using a for loop, and displays the result.
- Aim: To concatenate two strings.
-
Experiment 16: Find length of string
- Aim: Find the length of the string without using library function.
- Algorithm: Input string, count characters until null character is encountered, display the count, end.
- Program: Includes <stdio.h>, takes string as input, counts characters using while loop, prints the length.
-
Experiment 17: Frequency of a character
- Aim: To find the frequency of a character in a string.
- Algorithm: Input String and character, traverse string, count occurrences; display frequency.
- Program: Includes <stdio.h>, takes strings and character as input, counts using for loop.
-
Experiment 18: Store and display student information in a structure
- Aim: To store and display student information using a structure.
- Algorithm: Defines a structure, takes student information as input (name, roll no, marks), stores data, and displays as output.
-
Program: Includes <stdio.h>, defines a structure named "student", takes input data using for loops for multiple students; prints all student data with their roll number.
-
Experiment 19: Process student information
- Aim: To process and determine total marks, highest subject mark, and highest total mark of students.
- Algorithm: Input student data, compute total marks, find highest marks in each subject, and the student with the highest overall total marks, display results.
- Program: Includes <stdio.h>, defines structure, takes inputs for the details of students, computes the total for each student; finds the highest total score for each subject and for all subjects, displays result.
-
Experiment 20: Demonstrate file operations
- Aim: To demonstrate counting characters, words, and lines in a file and replacing specific words within a file.
- Algorithm: Open file, compute counts, write buffer overwriting content in the file, display results.
- Program: Includes <stdio.h>, <stdlib.h>, and <string.h>, functions to count characters, words, and lines, and another function to replace certain words in the file.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your knowledge on various concepts covered in the 24ESPL101 - Programming in C Laboratory. This quiz includes questions about basic operations in a calculator program, I/O statements, and experiments related to number properties. Perfect for students looking to reinforce their understanding of C programming fundamentals.