C Program to Find Maximum of Three Numbers using Conditional Operator

  • Write a C program to find maximum of three numbers using conditional operator.
  • How to find largest of three numbers using ternary operator.

Required Knowledge
C printf and scanf functions
Conditional Operator in C

Algorithm to find maximum of three numbers using conditional operator Let A, B and C are three numbers.

  • We will first find the largest of A and B. Let it be X.
  • Then we will compare X with third number C to get the overall largest number.

C program to find maximum of three numbers using conditional operator

C program to find maximum of three numbers using conditional operator

#include <stdio.h>  
   
int main()  {  
    int a, b, c, max;  
    /* 
     * Take three numbers as input from user 
     */ 
    printf("Enter Three Integers\n");  
    scanf("%d %d %d", &a, &b, &c);  
     
    max = (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c);
   
    /* Print Maximum Number */ 
    printf("Maximum Number is = %d\n", max);  
   
    return 0;  
}

Output

Enter Three Integers
9 1 4
Maximum Number is = 9

C Program to Check Whether a Number is Positive, Negative or Zero

C Program to Check Whether a Number is Positive, Negative or Zero
  • Write a C program to read a number and check whether number is positive, negative or zero.
  • Wap in C to check whether a number is negative, zero or positive using if else ladder.

Required Knowledge

We will first take an integer as input from user using scanf function. Then we check whether input number is positive, negative or zero using if else ladder statement.

C program to check whether an integer is negative, positive or zero

C Program to Check Whether a Number is Positive, Negative or Zero

/** 
 * C program to check whether a number is 
 * positive, negative or zero
 */ 
   
#include <stdio.h>  
   
int main() {  
    int number;  
    /* 
     * Take a number as input from user 
     */ 
    printf("Enter a Number\n");  
    scanf("%d", &number);  
       
    if(number > 0) {  
        printf("%d is Positive Number", number);  
    } else if (number < 0) {  
        printf("%d is Negative Number", number);  
    } else {  
        printf("Input Number is Zero");  
    }  
     
    return 0;  
}

Output

Enter a Number
5
5 is Positive Number
Enter a Number
-3
-3 is Negative Number
Enter a Number
0
Input Number is Zero

C Program to Check Whether a Number is Odd or Even Number using Switch Case Statement

  • Write a C program to check whether it is odd or even number using switch case statement.
  • How to check a number is odd or even in C.

Required Knowledge

Any numbers divisible by 2 are even numbers whereas numbers which are not divisible by 2 are odd numbers. Any even number can be represented in form of (2*N) whereas any odd number can be represented as (2*N + 1). Even Numbers examples: 2, 6 , 10, 12 Odd Number examples: 3, 5, 9 ,15

C program to check a number is Even of Odd using switch case statement

C program to check a number is Even of Odd using switch case statement

#include <stdio.h>
#include <conio.h>  
   
int main() {  
    int num;  
   
    /* Take a number as input from user
  using scanf function */
    printf("Enter an Integer\n");  
    scanf("%d", &num);  
   
    switch(num%2) {     
        /* Even numbers completely are divisible by 2  */ 
        case 0: printf("%d is Even", num);  
                break;  
        /* Odd numbers are not divisible by 2 */ 
        case 1: printf("%d is Odd", num);  
                break;  
    }  
     
    getch();
    return 0;  
}

Output

Enter an Integer
8
8 is Even
Enter an Integer
5
5 is Odd

C Program to Print all Strong Numbers Between 1 to N

Write a C program to print all strong numbers between 1 to N.
Wap in C to find strong numbers between 1 to 100.

Required Knowledge

A number is a strong number if the sum of factorial of digits is equal to number itself.
For Example: 145 is a strong number. !1 + !4 + !5 = 145

C program to print all strong numbers between 1 to N

C Program to Print all Strong Numbers Between 1 to N

#include <stdio.h>
#include <conio.h>
  
int main(){
    int N, num, temp, digit, nFactorial, counter, factSum;
     
    printf("To find all strong numbers between 1 to N");
    printf("Enter value of N");
    scanf("%d",&N);
     
    printf("List of strong numbers between 1 to %d\n", N);
    for(num = 1; num <= N; num++){
        /* Calculate sum of factorial of digits of num */
        temp = num;
        factSum = 0;
        while(temp){
           digit = temp%10;   
           /* Calculate factorial of every digit 
            * N! = N*(N-1)*(N-2)*(N-3)*.....*3*2*1 
            */
           for(counter=1, factorial=1; counter<=digit; counter++){
               factorial = factorial * counter;
           }
           factSum += factorial;
           temp = temp/10;
        }
         
        if(factSum == num)
           printf("%d ", num);
    
    }
    getch();
    return 0;
}

Output

To find all strong numbers between 1 to N
Enter value of N
1000
List of strong numbers between 1 to 1000
1 2 145

C Program to Add Digits of a Number

C Program to Add Digits of a Number

To add digits of a number we have to remove one digit at a time we can use ‘/’ division and ‘%’ modulus operator. Number%10 will give the least significant digit of the number, we will use it to get one digit of number at a time. To remove last least significant digit from number we will divide number by 10.

Sum of digits of 2534 = 2 + 5 + 3 + 4 = 14

Algorithm to find sum of digits of a number

  • Get least significant digit of number (number%10) and add it to the sum variable.
  • Remove least significant digit form number (number = number/10).
  • Repeat above two steps, till number is not equal to zero.

For example
Reading last digit of a number : 1234%10 = 4
Removing last digit of a number : 1234/10 = 123

C Program to add digits of a number using loop

This program takes a number as input from user using scanf function. Then it uses a while loop to repeat above mentioned algorithm until number is not equal to zero. Inside while loop, on line number 14 it extract the least significant digit of number and add it to digitSum variable. Next it removes least significant digit from number in line number 17. Once while loop terminates, it prints the sum of digits of number on screen.

C Program to Add Digits of a Number

/*
* C Program to find sum of digits of a number
*/
#include <stdio.h>
#include <conio.h>
 
int main(){
    int number, digitSum = 0;
    printf("Enter a number : ");
    scanf("%d", &number);
    while(number != 0){
        /* get the least significant digit(last digit) 
         of number and add it to digitSum */
        digitSum += number % 10;
        /* remove least significant digit(last digit)
         form number */
        number = number/10;
    }     
    printf("Sum of digits : %d\n", digitSum);
    getch();
    return 0;
}

Program Output

Enter a number : 1653
Sum of digits : 15

C program to find sum of digits of a number using function

This program uses a user defined function ‘getSumOfDigit’ to find the sum of digits of a number. It implements the algorithm mentioned above using / and % operator.

C program to find sum of digits of a number using function

/*
* C Program to print sum of digits of a number using number
*/
#include <stdio.h>
#include <conio.h>
 
int main(){
    int num;
    printf("Enter a number : ");
    scanf("%d", &num);
    printf("Sum of digits of %d is %d\n", num, getSumOfDigit(num));
    getch();
    return 0;
}
 
/*
 * Function to calculate sum of digits of a number
 */
int getSumOfDigit(int num){
    int sum = 0;
    while(num != 0){
        /* num%10 gives least significant digit of num */
        sum = sum + num%10;
        num = num/10; 
    }
    return sum;
}

Program Output

Enter a number : 5423
Sum of digits of 5423 is 14

Array Initialization in C Programming

Initialization of Array in C programming language. Arrays in C programming language is not initialized automatically at the time of declaration. By default, array elements contain garbage value. Like any other variable in C, we can initialize arrays at the time of declaration.

Array Initialization by Specifying Array Size

int score[7] = {5,2,9,1,1,4,7};

Initialization of array after declaration.

int score[7];
score[0] = 5;
score[1] = 2;
score[2] = 9;
score[3] = 1;
score[4] = 1;
score[5] = 4;
score[6] = 7;

Array Initialization Without Specifying Array Size

int score[] = {5,2,9,1,1,4,7};

In above declaration, compiler counts the number Of elements inside curly braces{} and determines the size of array score. Then, compiler will create an array of size 7 and initialize it with value provided between curly braces{} as discussed above.

C Program to show Array Initialization

Array Initialization in C Programming

#include <stdio.h>
#include <conio.h>
 
int main(){
    /* Array initialization by specifying array size */
    int roll[7] = {1,2,3,4,5,6,7};
    /* Array initialization by without specifying array size */
    int marks[] = {5,2,9,1,1,4,7};
    int i;
    /* Printing array elements using loop */
    printf("Roll_Number   Marks\n");
    for(i = 0; i < 7; i++){
        printf("%5d   %9d\n", roll[i], marks[i]);
    }
     
    getch();
    return 0;
}

Output

Roll_Number   Marks
    1           5
    2           2
    3           9
    4           1
    5           1
    6           4
    7           7

DBMS Practical Lab Manual File PDF Download | Data Base Management System Notes & Study Material

dbms-practical

DBMS Practical: Here in this article, students will find a list of notes and study material, DBMS practical questions, and answers pdf on the subject which can help them better understand the prerequisites required for their viva on Data Base Management System. You can use them as quick guidance to resolve doubts if any by using every possible related content of the Data Base Management System such as syllabus, Reference Books, DBMS Lab Programs with Solutions PDF, etc. all in one place.

Students can also visit Department Wise Lecture Notes for Preparation.

There are a lot of helpful resources which are available for the DBMS Practical; some of them are as follows:

Introduction to DBMS Practical Lab Manual

DBMS is an important subject which looks at the handling of data and databases. The DBMS Practical looks at the practical elements of the subject, which include experiments and application-based uses of the subject.

Some of the experiments included for the practice are as follows.

  • Drawing different kinds of models from a given database.
  • Implementation of a database and its functions
  • Data definition and modification once it has been created, etc.

B.Tech Data Base Management System Notes and Study Material PDF Free Download

Here students can find the various lab manuals that can help them understand how the lab experiments are conducted and the different viva questions that can be asked on the various systems used for DBMS. Students can download the study material and use it during their preparation process for the subject. Using the study materials provided by these notes will help aspirants get a better hunch on the concepts and the and an overall view on the subject.

The list of notes are as follows –

  • Lab manuals for Database Management System by Abhishek Apoorv
  • Lab manuals for Database Management System by JNTU Heros
  • Lab manuals for Database Management System by Umesh Kumar
  • Lab manuals for Database Management System by Snehal Kadavu

DBMS Practicals Reference Books

Books allow its readers to materialize the concepts better so that readers firstly get a more in-depth view of the subject and help them go over the specifics. Here in DBMS, there are different systems that users must become familiar with because the course required basic knowledge of systems that are important for DBMS. Students can use these books to understand various topics better and to score better grades during their exam.

The following is a list of books that students can utilize during their preparation process of the subject-

  • Learn PostgreSQL by Luca Ferrari, Enrico Pirozzi
  • PostgreSQL: The First Experience by Pavel Luzanov, Egor Rogov, Igor Levshi
  • Introducing InnoDB Cluster by Charles Bell
  • MySQL and JSON: A Practical Programming Guide by David Stokes
  • MySQL Connector/Python Revealed by Jesper Wisborg Krogh
  • Pro MySQL NDB ClusterBy Wisborg Krogh, Mikiya Okuno
  • MySQL Cluster 7.5 Inside and Out by Mikael Ronstrom
  • Cassandra: The Definitive Guide
  • Practical Cassandra: A Developer’s Approach
  • Learning Apache Cassandra
  • Apache Cassandra: Hands-on-Training

DBMS Practical Reference Books

DBMS Practicals Curriculum

The DBMS Practicals curriculum consists of various experiments which are carried out throughout the course. Below there is the DBMS Practicals curriculum listed experiment wise.

Experiment Aims
Experiment 1: ER diagram and relational model
  • To draw the ER model and Relational model for a given database.
  • To show ER to Relational model reduction.
Experiment 2: Creation and implementation of the database
  • To create the database with the proper constraints (Pk, Fk, etc.)
  • Insert into the database using different insert statements
  • Displaying the database
Experiment 3: Data Definition (Schema) Modification
  • To alter the table (add/remove column, add/remove constraint)
  • To drop table
  • To show schema of any table
  • To apply different constraints check
Experiment 4: Simple SQL Queries (single table retrieval)
  • To make use of different operators (logical, relational, etc.)
  • Selection of rows and columns
  • Renaming columns
  • Use of distinct keywords
  • String handling (%, etc.)
  • Updating statements and case updates
  • Deleting or cascade deleting
Experiment 5: Advanced SQL Queries
  • Group by/Having clause and aggregate function
  • Setting operations (union, all union, use of order by clause)
  • Nested queries: in, not_in, etc.
  • Join (Inner and Outer)
  • Exists and Union
Experiment 6: Implementation of views
  • Creation and usage of views
  • Creation of views using views
  • Drop view
Experiment 7: Triggers To create queries using Triggers.
Experiment 8: Procedures To create queries using Procedures.
Experiment 9: ORDBMS concepts To implement ORDBMS concepts.
Experiment 10: RDBMS To implement RDBMS using JDBC connectivity.

List of DBMS Practical Important Questions

  1. What is DBMS used for?
  2. What is meant by a Database?
  3. Why is the use of DBMS recommended? Explain by listing some of its major advantages.
  4. What is the purpose of normalization in DBMS?
  5. What are the different types of languages that are available in the DBMS?
  6. What is the purpose of SQL?
  7. Explain the concepts of a Primary key and Foreign Key.
  8. ub-query in terms of SQL?
  9. What is the use of DROP command and what are the differences between DROP, TRUNCATE and DELETE commands?
  10. What are the different levels of abstraction in the DBMS?
  11. What is Correlated Subquery in DBMS?
  12. Explain the concept of ACID properties in DBMS?
  13. What is the main difference between UNION and UNION ALL?
  14. What integrity rules that are the main differences between Primary key and Unique Key?
  15. What is the concept of sxist in the DBMS?
  16. What is 1NF in the DBMS?
  17. What is 2NF in the DBMS?

DBMS Practical Important Questions

FAQs About DBMS Practicals

Question 1.
What can I expect for my DBMS Practicals?

Answer: There are a cumulative ten experiments which are part of the DBMS Practicals course. Thus, out of the list of experiments mentioned in the DBMS Practicals curriculum, prepare all of them. Any experiment can come as your DBMS Practical so be wary and study all of them.

Question 2.
What are the best DBMS Practical reference books I can use to prepare?

Answer: The best DBMS Practical reference books are as follows:

  • Learn PostgreSQL by Luca Ferrari, Enrico Pirozzi
  • PostgreSQL: The First Experience by Pavel Luzanov, Egor Rogov, Igor Levshi
  • MySQL Cluster 7.5 Inside and Out by Mikael Ronstrom

Question 3.
What is the importance of DBMS Practicals?

Answer: DBMS Practicals are important because they help provide the student with a well-rounded knowledge of the subject. Having only bookish knowledge is not enough, a person must have an application based on practical understanding of all subjects as well. This ensures that the student has understood the subject and topics under it fully.

Question 4.
What is the DBMS Practical curriculum?

Answer: There are a total of 10 experiments that are part of the DBMS Practical curriculum, all of which are equally important in supporting the learning of the student. The curriculum includes relational database building, data definition and modification, simple and advanced SQL queries, implementation of views, Triggers, Procedures, ORDBMS concepts, and lastly, RDBMS.

Conclusion

From the above study material provided, the information provided is reliable and genuine. Students can use these notes in preparing for their lab experiments in DBMS as the provided lab manual notes, reference books, curriculum, and important questions will help aid them

Refer: 

DIVISLAB Pivot Point Calculator

Dynamics of Machinery Lecture Notes and Study Material PDF Free Download

dynamics-of-machinery-lecture-notes

Dynamics of Machinery Lecture Notes: Planning to choose a career in the field of Dynamics of Machinery. Acquiring the notes will help you to get good marks in the exam. This note includes a comprehensive study plan, all-important information and timetable. Students will get information about the latest Reference Books, Syllabus and Important Questions List for Dynamics of Machinery Lecture Notes.

Dynamics of Machinery Lecture Notes are one of the essential study materials that can improve the students preparation for the exam. Candidates with the help of these notes can score better marks.

The article given below helps the students access the best Dynamics of Machinery Lecture Notes as per the latest curriculum.

Introduction to Dynamics of Machinery Notes

Dynamics of machinery is a theoretical branch of study dealing with the mechanisms of machines and its motions by accounting for the different forces that act on them. This subject is concerned with understanding some basic problems such as: defining which laws govern the mechanisms of movement of the machines, understanding the control of the mechanisms, investigating the implications of friction and figuring how the balance works in the machines.

To understand the laws related to the motion of elements, mathematical tools such as differential equations are employed to characterize the forces acting on the system or the machine unit, one that usually comprises elements like a motor, transmission, and some control elements.

Dynamics of Machinery Lecture Notes and Study Material Free Download

In Dynamics of Machinery, you will learn the fundamentals of machinery, its terms, Effect of Precession motion and different aspects of the topic. Learning from Dynamics of Machinery Lecture Notes helps the student become active, so the learning process is improved. Aspirants can start their preparation with all the tools to help them score better marks in the exam. The students can refer and use the Dynamics of Machinery Lecture Notes pdf and Study Materials as a reference. Students pursuing mechanical engineering can also download PDF notes.

Dynamics of Machinery Lecture Notes Reference Books

Reference books for Dynamics of Machinery Lecture Notes are an essential source of information. It provides explanations and necessary information about the topics. Students should refer to books recommended by subject experts as it will help them to understand the subject accurately. Candidates will understand the topics if they consult the latest version that includes the updated syllabus. Here is a list of the best-recommended books for Dynamics of Machinery Lecture Notes.

Books Author
Theory of Machines Sadhu Singh
Theory of Machines Thomas Bevan
Design of Machinery Robert L Norton
Dynamics of Machinery S Balaguru
Kinematics and Dynamics of Machinery Norton
Theory of Machines S S Ratan
Machine and Mechanism Theory J S Rao and R V Dukkipati
Theory of Machines Khurmi

Dynamics of Machinery Syllabus

The best way to commence your preparation for the Dynamics of Machinery Lecture Notes course is to understand the syllabus and the topics of the subject. The syllabus of Dynamics of Machinery is a reliable course planning tool that plans and organises the subject for a student. The article on Dynamics of Machinery Lecture Notes provides a detailed structure along with the latest and updated syllabus, keeping in mind every student’s requirements and assessing their preparation efficiency.

The curriculum of Dynamics of Machinery provides students a clear idea about what and how to study and analyse the subject. The article on Dynamics of Machinery Lecture Notes presents all the essential topics under each unit so that students can allot time for each topic and prepare accordingly. Students must cover all the unit-wise topics before attempting the Dynamics of Machinery exam so that the exam paper is easy to answer. The updated syllabus also assures that students remain aware of the Dynamics of Machinery updated syllabus to prevent from wasting unnecessary time on irrelevant topics.

Here is a list of the updated syllabus for Dynamics of Machinery

Unit I

Precession

  • Gyroscopes
  • Effect of Precession motion
  • Static and Dynamic Force analysis of planar mechanisms
Unit II

Friction

  • Inclined Plane
  • Friction of Screw and Nuts
  • Pivot and Collar
  • Uniform and Pressure
  • Uniform Wear
  • Friction Circle and Friction Axis
  • Boundary Friction
  • Film Lubrication
Unit III

Clutches

  • Friction Clutches – Plate Clutch or Single Disc
  • Multiple Disc Clutch
  • Cone Clutch
  • Centrifugal Clutch

Brakes and Dynamometers

  • Simple Block Brakes
  • Internal Expanding Brake
  • Band Brake of Vehicle
  • Dynamometers – Transmission and Absorption
  • General Description and Methods of Operations
Unit IV

Turning Moment Diagram and Flywheels

  • Turning Moment – Torque Connecting Inertia
  • Torque Diagrams
  • Fluctuation of Energy
  • Fly Wheels and their Design
Unit V

GOVERNORS

  • Watt
  • Porter and P roell Governors
  • Sensitiveness
  • Isochronism and Hunting
Unit VI

BALANCING

  • Multiple and Single – Balancing of Rotating Masses
  • Single and Different planes
Unit VII

Balancing of Reciprocating Masses

  • Primary ,Secondary and higher Balancing of reciprocating Masses
  • Unbalanced Forces and Couples
  • Locomotive Balancing
  • Hammer Blow
  • Swaying Couple
  • Variation of Tractive Efforts.
Unit VIII

Vibration

  • Oscillation of Pendulums
  • Centers of Suspension and Oscillations
  • Transverse loads
  • Dunkerley’s Method
  • Rayleigh’s Method
  • Critical Speeds
  • Torsional Vibration
  • Transmissibility

List of Dynamics of Machinery Important Questions

Candidates pursuing Dynamics of Machinery can refer to the list of all the essential questions stated below for the Dynamics of Machinery Lecture Notes. The assigned questions are aimed to help the students to excel in the examination. Here is a list of questions that will help the students to understand the subject precisely.

  1. State the term static force analysis.
  2. Distinguish between free body and space diagram.
  3. When will the two force members be in equilibrium?
  4. Distinguish the difference between dynamic force analysis and static force analysis.
  5. Define the term D’Alembert’s principle.
  6. State the principle of superposition
  7. What is Piston effort?
  8. What are the fundamentals of an equivalent dynamical system?
  9. Explain the term Inertia force.
  10. State the difference between the flywheel and governor function.

Frequently Asked Questions on Dynamics of Machinery Lecture Notes

Question 1.
How are the Dynamics of Machinery Lecture notes and study materials Important?

Answer:
The notes of Dynamics of Machinery provides students a clear idea about what and how to study and analyse the subject. It gives students time for each topic to prepare accordingly.

Question 2.
Name some of the Reference books of Dynamics of Machinery?

Answer:
Some of the Reference books of Dynamics of Machinery: Theory of Machines, Dynamics of Machinery, Machine and Mechanism Theory and Design of Machinery.

Question 3.
State the term inertia?

Answer:
Inertia is the property of matter offering resistance to any change of uniform motion in a straight line or its state of rest .

Question 4.
Name some of the topics of Dynamics of Machinery?

Answer:
Some of the topics of Dynamics of Machinery: Gyroscopes, BALANCING, Oscillation of Pendulums, Watt and Centers of Suspension and Oscillations

Conclusion on Dynamics of Machinery Lecture Notes

The Dynamics of Machinery Lecture Notes and Study Materials presented above are aimed to assist the students at the time of exam preparations. They are reliable and have authoritative references focused on helping graduates and improving their knowledge and understanding of the subject during the time of preparation of the exam. Students can refer and practice from the provided notes for Dynamics of Machinery and essential questions from this article.

DRREDDY Pivot Calculator

C++ Program to Copy String Without Using strcpy

In the previous article, we have discussed C++ Program to Concatenate Two Strings. In this article, we will see C++ Program to Copy String Without Using strcpy.

C++ Program to Copy String Without Using strcpy

  • Write a C++ program to copy one string into another string without using strcpy.

C++ program to copy string without using strcpy

C++ program to copy string without using strcpy

#include <iostream>
 
using namespace std;
 
int main(){
    char source[1000], copy[1000];
    int index = 0;
     
 cout << "Enter a string" << endl;
    cin.getline(source, 1000);
    // Copy String 
    while(source[index] != '\0'){
        copy[index] = source[index];
        index++;
    }
    copy[index] = '\0';
    cout << "Input String: " << source << endl;
    cout << "Copy String: " << copy;
      
    return 0;
}

Output

Enter a string
APPLE
Input String: APPLE
Copy String: APPLE

The popular Examples of C++ Code are programs to print Hello World or Welcome Note, addition of numbers, finding prime number and so on. Get the coding logic and ways to write and execute those programs.

C++ Program to Access Elements of an Array Using Pointer

In the previous article, we have discussed C++ Program to Multiply Two Matrices. In this article, we will see C++ Program to Access Elements of an Array Using Pointer.

C++ Program to Access Elements of an Array Using Pointer

  • How to traverse elements of an array using pointers in C++.
  • C++ program to print elements of an array using pointers.

C++ Program to print elements of an array using pointer

C++ Program to print elements of an array using pointer

#include <iostream>
 
using namespace std;
 
int main(){
   int array[100], num, i;
   cout << "Enter Number of elements\n";
   cin >> num;
   cout << "Enter " << num << " Integers\n";
   for(i = 0; i < num; ++i){
      cin >> array[i];
   }
   cout << "Array Content\n";
   for(i = 0; i < num; ++i){
      cout << *(array+i) << " ";
   }
   return 0;
}

Output

Enter Number of elements
6
Enter 6 Integers
7 3 2 5 9 1
Array Content
Enter 6 Integers
7 3 2 5 9 1

Know the collection of various Basic C++ Programs for Beginners here. So that you can attend interviews with more confidence.