Skip to main content

Posts

Showing posts from February, 2020

C++ For Loop (फॉर लूप )

C++ For Loop(फॉर  लूप ) The C++ for loop is used to iterate a part of the program several times.  If the number of iteration is fixed, it is recommended to use for loop than while or do-while loops. The C++ for loop is same as C/C#.  We can initialize variable, check condition and increment/decrement value. for (initialization; condition; incr/decr) {     //code to be executed      }  PetaByte Center C++ For Loop Example #include <iostream.h>    int  main()  {             for ( int  i=1;i<=10;i++) {                    cout<<i << "\n" ;          } }     Output:1 2 3 4 5 6 7 8 9 10 C++ Nested For Loop In C++, we can use for loop inside another for loop, it is known as nested for loop.  The inner loop is executed fully when outer loop is executed one time.  So if outer loop and inner loop are executed 4 times, inner loop will be executed 4 times for each out

Boolean algebra

Boolean algebra Boolean algebra can be considered as an algebra that deals with binary variables and logic operations. Boolean algebraic variables are designated by letters such as A, B, x, and y. The basic operations performed are AND, OR, and complement. The Boolean algebraic functions are mostly expressed with binary variables, logic operation symbols, parentheses, and equal sign. For a given value of variables, the Boolean function can be either 1 or 0. For instance, consider the Boolean function: F = x + y'z The logic diagram for the Boolean function F = x + y'z can be represented as: The Boolean function F = x + y'z is transformed from an algebraic expression into a logic diagram composed of AND, OR, and inverter gates. Inverter at input 'y' generates its complement y'. There is an AND gate for the term y'z , and an OR gate is used to combine the two terms (x and y'z). The