
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

749 Views
Float is a shortened term for "floating-point." By definition, it's a fundamental data type built into the compiler that's used to define numeric values with floating decimal points. A floating-point type variable is a variable that can hold a real number, such as 4320.0, -3.33, or 0.01226. The floating part of the name floating point refers to the fact that the decimal point can “float”; that is, it can support a variable number of digits before and after the decimal point.floating pointCategoryTypeMinimum SizeTypical Sizefloating pointfloat4 bytes4 bytesdouble8 bytes8 byteslong double8 bytes8, 12, or 16 bytesFloating-point rangeSizeRangePrecision4 bytes±1.18 x 10-38 to ... Read More

680 Views
The string is actually a one-dimensional array of characters which is terminated by a null character '\0'. Thus a null-terminated string contains the characters that comprise the string followed by a null.To find the length of a string we need to loop and count all words in the loop until the ‘\0’ character is matched.For exampleInput −naman Output − string length is 5Explanation − we need to iterate over each index of the string until reach the end of string means ‘\0’ which is the null character. Example#include #include int main() { char string1[]={"naman"}; int i=0, length; while(string1[i] !='\0') ... Read More

753 Views
For a number n given, we need to find whether all digits of n divide it or not i.e. if a number is ‘xy’ then both x and y should divide it.SampleInput - 24 Output - Yes Explanation - 24 % 2 == 0, 24 % 4 == 0Using conditional statements checking if each digit is non-zero and divides the number. We need to iterate over each digit of the number. And the check for the divisibility of the number for that number.Example#include int main(){ int n = 24; int temp = n; int flag=1; while (temp > ... Read More

10K+ Views
A palindrome is a word, number, phrase, or other sequences of characters which reads the same backward as forward. Words such as madam or racecar or the number 10801 are a palindrome.For a given string if reversing the string gives the same string then we can say that the given string is a palindrome. Which means to check for the palindrome, we need to find whether the first and last, second and last-1, and so on elements are equal or not.Input − naman Output − string is a palindrome Input − tutorials point Output − string is not a palindromeIn C++ Program to ... Read More

1K+ Views
To delete a tree we need to traverse each node of the tree and then delete each of them. this one by one delete every node of the tree and makes it empty. For this, we need to use a method that traverses the tree from bottom to up so that we can delete the lower notes first and then their parents so that no extra complexities arise. Based on the condition that we need, The postorder traversal will be the best suited And works efficiently so that our program will be optimum.The post-order for the following tree is -2-6-4-12-17-15The ... Read More

393 Views
A function that returns 2 for input 1 and 1 for input 2 is to be made. This function can be made in many ways based on the logic you use. The easiest way to do this is to use a conditional statement that if the number is 1 then return 2 otherwise return 1 and ways include using mathematical operations (any will do) and XOR operation.Example#include // Method 1 using the if statement int reverseif(int x) { if (x == 1) return 2; else return 1; } // Method 2 using the subtarction form sum of ... Read More

267 Views
To print any string without using a semicolon we need to find how the standard output work and why is semicolon used.The semicolon is a end of line statement that is used to tell the program that the line is ended here. The standard print statement printf used here is a method of the standard io library. Let's dig deep into the printf() method.int printf(const char *format , ...)This method returns an integer and has a set of arguments format and … . The format is a string that is printed in the output screen. And the … is the ... Read More

681 Views
In this problem, you are given N painting and we have m color that we can make paintings with and we need to find the number of ways in which we can draw the painting such that none of the same color paintings are to each other.The program’s output can have very large values and handing these values is a bit problem so we will calculate its answer in standard modulo 109 +7.The formula to find the number ways is :Ways = n*(m-1)(n-1)Example to describe the problem, this will need the number of paintings n and number of colors m ... Read More

483 Views
The surface area of any figure is the total area that it's surface cover.A hexagonal prism is a three-dimensional figure that has a hexagon at both its ends. exam on prism looks like -In mathematics, Hexagonal prism is defined as three dimensional figure with 8 faces, 18 edges, 12 vertices.Surface Area = 3ah + 3√3*(a2) Volume = (3√3/2)a2hExample#include #include int main() { float a = 5, h = 10; //Logic to find the area of hexagonal prism float Area; Area = 6 * a * h + 3 * sqrt(3) * a * a; ... Read More

531 Views
The concept of super perfect number is similar to the perfect number. It was found by D Suryanarayana in 1969. He generalized the super perfect number as a number that satisfies the following formula :sig(sig(n)) = 2nHere, sig(n) is the function that calculates the sum of divisors of a number, it is also known as divisor summatory function.The following example with making this concept clear to you :we need to check if the number N is a superperfect number or not:N = 16OutputyesExplanation − to check whether a number is a perfect number or not we will find the sum ... Read More