
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 1339 Articles for C

32K+ Views
In C, we have containers to hold data of same data type as well as different data types. C provides the concept of Arrays to store data variables of same type; while for storing data of different types, C has the concept of structures and unions. Both Structures and Unions can hold different types of data, but on the basis of their internal implementation, we can find several differences in both of these containers. Read this article to learn more about structures and unions and how they are different from each other. What is Structure in C Program? In C ... Read More

884 Views
Suppose we have a number n. We have to check whether the number is the power of 2 or not. So is n = 16, then the output will be true, if n = 12, it will be false.To solve this we will use logical operations. If we see the numbers that are the power of two then in the binary representation of that number will be the MSb is 1, and all other bits are 0. So if we perform [n AND (n – 1)], this will return 0 if n is the power of 2. If we see ... Read More

918 Views
Program DescriptionPrint Square inside a Square as shown belowAlgorithmAccept the number of rows the outer Square to be drawn Display the Outer Square with the number of rows specified by the User. Display another square inside the outer square.Example/* Program to print Square inside Square */ #include int main() { int r, c, rows; clrscr(); printf("Enter the Number of rows to draw Square inside a Square: "); scanf("%d", &rows); printf(""); for (r = 1; r

837 Views
Program DescriptionIn geometry, a square is a regular quadrilateral, which means that it has four equal sides and four equal angles.Solid and Hollow Square will appear as shown belowAlgorithmFor Solid Square −Accept the Number of Rows from the user to draw the Solid Square For each Row, Print * for each Column to draw the Solid SquareFor Hollow Square −Accept the Number of Rows from the user to draw the Hollow Square For the First and Last Row, Print * for each Column For the Remaining Rows, Print * for the first and Last Column.Example/* Program to print hollow and ... Read More

615 Views
Program DescriptionPrint the Solid and Hollow Rhombus Patterns as show belowAlgorithmFor Hollow Rhombus −Accept the Number of Rows for Hollow Rhombus from the User Create a Hollow Rhombus containing the same number of Rows specified by the User. Print the first row containing the number of stars same as the number of rows. Print the second row containing the first and last star as show in the output and leave the spaces between first and the last star. Do the same till you reach the last Row. Print the last row containing the number of stars same as the number ... Read More

660 Views
Program DescriptionPrint the Right and Left arrow PatternsAlgorithmAccept the number of rows to print the Left and Right Arrow Pattern.Print Upper Part of the Arrow with Stars Patterns Print Inverted Right Triangle with Stars Patterns Print Bottom Part of the Arrow with Stars Patterns Print the Right Triangle with Stars PatternsExample/*Program to print the Left and right arrow pattern*/ #include int main() { int r, c, rows; //Left Arrow Pattern int r1, c1, rows1; //Right Arrow Pattern clrscr(); printf("Enter number of rows to print the Left Arrow Pattern: "); scanf("%d", &rows); printf(""); printf("The ... Read More

519 Views
Program DescriptionFloyd's triangle is a right-angled triangular array of natural numbers, used in computer science education. It is named after Robert Floyd. It is defined by filling the rows of the triangle with consecutive numbers, starting with a 1 in the top left corner1 15 14 13 12 11 2 3 10 9 8 7 4 5 6 6 ... Read More

4K+ Views
Program DescriptionA pyramid is a polyhedron formed by connecting a polygonal base and a point, called the apex. Each base edge and apex form a triangle, called a lateral face. It is a conic solid with polygonal base. A pyramid with an n-sided base has n + 1 vertices, n + 1 faces, and 2n edges. All pyramids are self-dual.AlgorithmAccept the number of rows from the user to form pyramid shape Iterate the loop till the number of rows specified by the user: Display 1 star in the first row Increase the number of stars based on the number of ... Read More

232 Views
Program DescriptionA pentatope number is a number in the fifth cell of any row of Pascal's triangle starting with the 5-term row 1 4 6 4 1 either from left to right or from right to left.The first few numbers of this kind are1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001, 1365Pentatope numbers belong in the class of figurate numbers, which can be represented as regular, discrete geometric patterns. The formula for the nth pentatopic number is$$\left(\begin{array}{c}n+3\ 4\end{array}\right)=\left(\frac{n(n+1)+(n+2)+(n+3)}{24}\right)=\left(\frac{n^2}{4!}\right)$$AlgorithmAccept the Nth Term from the User to find the Pentotope Numbers.Use the formula$$\left(\begin{array}{c}n+3\ 4\end{array}\right)=\left(\frac{n(n+1)+(n+2)+(n+3)}{24}\right)=\left(\frac{n^2}{4!}\right)$$Example/* Program to print pentatope numbers ... Read More

761 Views
Program DescriptionPrint the numeric pattern by accepting the number of rows from the user.Input: 5 Rows1 6 2 10 7 3 13 11 8 4 15 14 12 9 5AlgorithmPrint the pattern from the end of each Row Complete the last column of each Row Start from the Second Last Column of the second row Repeat till the number of rows specified by the User.Example/*Program to print Numeric Pattern */ #include int main() { int k, l, m, count=1; int rows; clrscr(); printf(" Please enter the number of rows for the Numeric Pattern: "); scanf("%d",&rows); for (k = 1; k