
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

17K+ Views
The two’s complement for a given binary number can be calculated in two methods, which are as follows −Method 1 − Convert the given binary number into one’s complement and then, add 1.Method 2 − The trailing zero’s after the first bit set from the Least Significant Bit (LSB) including one that remains unchanged and remaining all should be complementing.The logic to find two’s complement for a given binary number is as follows −for(i = SIZE - 1; i >= 0; i--){ if(one[i] == '1' && carry == 1){ two[i] = '0'; } else ... Read More

3K+ Views
These are used by the programmers to create their own data types and define what values the variables of these datatypes can hold.The keyword is enum.SyntaxThe syntax for enumerated data type is as follows −enum tagname{ identifier1, identifier2, ……., identifier n };ExampleGiven below is an example for enumerated data type −enum week{ mon, tue, wed, thu, fri, sat, sun };Here, Identifier values are unsigned integers and start from 0.Mon refers 0, tue refers 1 and so on.ExampleFollowing is the C program for enumerated data type − Live Demo#include main ( ){ enum week {mon, tue, wed, thu, fri, ... Read More

44K+ Views
In a given matrix, when most of the elements are zero then, we call it as sparse matrix. Example − 3 x3 matrix1 1 0 0 0 2 0 0 0In this matrix, most of the elements are zero, so it is sparse matrix.ProblemCheck whether a matrix is a sparse matrix or not.SolutionLet us assume ZERO in the matrix is greater than (row * column)/2.Then, the matrix is a sparse matrix otherwise not.ProgramFollowing is the program to check whether the given matrix is sparse matrix or not − Live Demo#include #include int main(){ int row, col, i, j, a[10][10], count ... Read More

3K+ Views
To begin with, let us understand what are trailing zeros in a binary number.Trailing zerosThe position of zeros after first one from the least significant bit (LSB) is called as trailing zeros in binary number.Example104 is decimal numberBinary number of 104 is: (MSB) 1101000(LSB)Here, MSB refers to Most Significant Bit.LSB refers to Least Significant Bit.From LSB after the first bit set, there are three zero.The number of trailing zeros is three.ExampleFollowing is the program to count number of trailing zeros for a given number − Live Demo#include #include int main(){ int number, i, trail = 0, size; printf("Enter a ... Read More

3K+ Views
Consider the factors given below to write a C program to rotate the bits for a given number.Rotating the bit from left to right or right to left.In left rotation, the bits are shifted from left to right.In right rotation, the bits are shifted from right to left.Take a number and try to rotate either left or right based on user program.User has to enter the number rotation at run time along with a number.Program 1Following is the C program to apply left rotation for a given number. Live Demo#include #include int main(){ int number, rotate, Msb, size; printf("Enter ... Read More

64K+ Views
Triangle consists of three sides and three angles. Based on the three sides, there are three types of triangle −Equilateral triangle: All three sides are equal.Isosceles triangle: All two sides are equal.Scalene triangle: No sides are equal.Follow the algorithm given below for writing the respective program.AlgorithmStep 1: Declare three sides of triangle. Step 2: Enter three sides at run time. Step 3: If side1 == side2 && side2 == side3 Go to step 6 Step 4: If side1 == side2 || side2 == side3 || side3 == side1 Go to Step 7 Step 5: Else Go to step 8 Step ... Read More

4K+ Views
Enter the start and stop time with hours, minutes and seconds. Finally, we need to find the difference between start and stop time.The logic to find the difference between start and stop time is given below −while (stop.sec > start.sec){ --start.min; start.sec += 60; } diff->sec = start.sec - stop.sec; while (stop.min > start.min) { --start.hrs; start.min += 60; } diff->min = start.min - stop.min; diff->hrs = start.hrs - stop.hrs;ExampleFollowing is the program to find difference between start and stop time − Live Demo#include struct time { int sec; int min; int hrs; ... Read More

4K+ Views
An array of characters is called a string. Declaration Following is the declaration declaring an array is as follows − char stringname [size]; For example: char string[50]; string of length 50 characters Initialization Using single character constant − char string[10] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’ ,‘\0’} Using string constants − char string[10] = "Hello":; Accessing − There is a control string "%s" used for accessing the string till it encounters ‘\0’. Finding maximum occurrence The logic to find the maximum occurrence of character is − ... Read More