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.
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 ______.
The academic year for the 24ESPL101 - PROGRAMMING IN C Laboratory is ____.
The academic year for the 24ESPL101 - PROGRAMMING IN C Laboratory is ____.
The first experiment involves using I/O statements and ____.
The first experiment involves using I/O statements and ____.
One of the experiments focuses on checking for a ____ year.
One of the experiments focuses on checking for a ____ year.
The algorithm for displaying values using data types starts with 'Start the ____.'
The algorithm for displaying values using data types starts with 'Start the ____.'
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.
One of the practices includes finding the ____ of a given number.
One of the practices includes finding the ____ of a given number.
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.
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.
The program checks if a number is positive, negative, or ______.
The program checks if a number is positive, negative, or ______.
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.
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 ______.
The variables declared to compare two numbers are ______ and y.
The variables declared to compare two numbers are ______ and y.
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 ______.
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.
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.
To input a number, the program uses the ______ function.
To input a number, the program uses the ______ function.
Step 2 Get the ______
Step 2 Get the ______
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.
Check if the year Modulo ______ equal to 0
Check if the year Modulo ______ equal to 0
If YES print ______ year
If YES print ______ year
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.
If the user selects ______ (option 1):
If the user selects ______ (option 1):
If the divisor is not zero, calculate the ______.
If the divisor is not zero, calculate the ______.
Step 9 ______
Step 9 ______
If a > b go to step ______ Otherwise go to step 5
If a > b go to step ______ Otherwise go to step 5
If a > c then print '______ is greatest' Otherwise print c is greatest
If a > c then print '______ is greatest' Otherwise print c is greatest
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.
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 ______'
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
Else if a%5 == 0 then print 'Divisible by ______'
Else if a%5 == 0 then print 'Divisible by ______'
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.
The program checks if a given number is an ______ number.
The program checks if a given number is an ______ number.
The user is prompted to enter a three-digit ______.
The user is prompted to enter a three-digit ______.
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.
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.
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.
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.
The final output confirms whether the input number is an ______ or even.
The final output confirms whether the input number is an ______ or even.
To find the factorial of a number, a variable named ______ is used.
To find the factorial of a number, a variable named ______ is used.
Flashcards
What is a data type in C?
What is a data type in C?
A data type in C that represents a sequence of characters.
List some examples of Data types in C.
List some examples of Data types in C.
Integer, float, and char are some examples of data types in C, each capable of storing different types of data.
What is an Algorithm?
What is an Algorithm?
A set of instructions that tells the computer what to do.
What is a program?
What is a program?
Signup and view all the flashcards
What are input statements?
What are input statements?
Signup and view all the flashcards
What are output statements?
What are output statements?
Signup and view all the flashcards
What are expressions?
What are expressions?
Signup and view all the flashcards
Explain Variable declaration in C.
Explain Variable declaration in C.
Signup and view all the flashcards
Integer Variable
Integer Variable
Signup and view all the flashcards
If-Else Statement
If-Else Statement
Signup and view all the flashcards
C Program
C Program
Signup and view all the flashcards
Greater Than Operator
Greater Than Operator
Signup and view all the flashcards
If Block
If Block
Signup and view all the flashcards
Else Block
Else Block
Signup and view all the flashcards
Else If Ladder
Else If Ladder
Signup and view all the flashcards
Condition
Condition
Signup and view all the flashcards
What is a string in C?
What is a string in C?
Signup and view all the flashcards
What is the purpose of the printf()
function?
What is the purpose of the printf()
function?
Signup and view all the flashcards
What is the purpose of the scanf()
function?
What is the purpose of the scanf()
function?
Signup and view all the flashcards
What is an if statement?
What is an if statement?
Signup and view all the flashcards
What is an 'if-else if' statement?
What is an 'if-else if' statement?
Signup and view all the flashcards
What is an 'else' statement?
What is an 'else' statement?
Signup and view all the flashcards
What is a loop?
What is a loop?
Signup and view all the flashcards
What is nested if-else?
What is nested if-else?
Signup and view all the flashcards
What is a string?
What is a string?
Signup and view all the flashcards
What is a switch statement?
What is a switch statement?
Signup and view all the flashcards
What is a newline character?
What is a newline character?
Signup and view all the flashcards
What is the default case?
What is the default case?
Signup and view all the flashcards
What is a leap year?
What is a leap year?
Signup and view all the flashcards
What is the modulo operator?
What is the modulo operator?
Signup and view all the flashcards
How to determine a leap year?
How to determine a leap year?
Signup and view all the flashcards
What is a simple arithmetic calculator?
What is a simple arithmetic calculator?
Signup and view all the flashcards
What is a calculator menu?
What is a calculator menu?
Signup and view all the flashcards
What is a program flowchart?
What is a program flowchart?
Signup and view all the flashcards
What is division by zero?
What is division by zero?
Signup and view all the flashcards
String literal
String literal
Signup and view all the flashcards
String variable (in C)
String variable (in C)
Signup and view all the flashcards
Armstrong Number Checker
Armstrong Number Checker
Signup and view all the flashcards
Odd or Even Checker
Odd or Even Checker
Signup and view all the flashcards
Factorial Calculator
Factorial Calculator
Signup and view all the flashcards
C Programming
C Programming
Signup and view all the flashcards
Escape Sequences
Escape Sequences
Signup and view all the flashcards
Input Function (scanf)
Input Function (scanf)
Signup and view all the flashcards
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.