Explain the Output: printf("%%%%");
CODE: Why only 3 “%” are printed while the printf contains 6 “%” characters? #include<stdio.h> int main() { printf("%%%%%%n"); return 0; } OUTPUT: %%%
Professional way of Programming
CODE: Why only 3 “%” are printed while the printf contains 6 “%” characters? #include<stdio.h> int main() { printf("%%%%%%n"); return 0; } OUTPUT: %%%
One of the most effective way to swap two numbers is by using XOR gate. We do not any third variable to store value, therefore it has lower space complexity than the traditional swapping program using third or temporary variable. How it works? To understand this trick, break the statements into unique values: x1 = … Read more
What are Templates: Templates in C++ are the foundation of generic programming, which involves writing code in a way that is independent of any particular type. C++ uses Standard Template Library (STL) for templates. A template is a blueprint or formula for creating a generic class or a function. The library containers like iterators and … Read more
If you are learning DSA and algorithms, it is really important for you to know how to calculate the Time complexity for any given algorithm. Lets understand the same with example Time Complexity Calculation: The most common metric for calculating time complexity is Big O notation. This removes all constant factors so that the running … Read more
How matrix multiplication in C++ Works: Input two matrices. Run 3 for loops (i,j,k). Multiplication will be addition of First_Matrix[i][k]*Second_Matrix[k][j] for each element. Resultant matrix is stored in third Matrix. CODE: #include<iostream> using namespace std; int main(){ //Using const int for array size const int row=2,col=2; // if not use const error found … Read more
We all know what is table of a number. Here is the code to print table of a number in c, entered by the user. CODE: #include<iostream> using namespace std; int main() { int num; cout<<"Enter Number To Find Multiplication table "; cin>>num; for(int a=1;a<=10;a++) { cout<<num<<" * "<<a<<" = "<<num*a<<endl; } return 0; … Read more