January 13, 2015

Things you don't know about scanf()

Scanf() is an inbuilt function in the C Standard libraries. This is used to get input from the user and store that in a variable.
scanf provides inbuilt mechanisms to tackle with de-limiters which many people are not aware of. So, today we'll show you how you can limit your input till a certain symbol.

Consider we have a variable declared as
char a[20];
Reading a String:
To read a string usually we use '%S'. Instead of that we can also use the following way to get the value till you encounter '\n' and discard it.
This only stores the value till '\n' is encountered and discards it.
To read till a Comma:
Just like the above scenario we will use comma (,) as our delimiter. That would be,

August 04, 2014

The Earth is Flat | Flat Earth Society

The earth as we know is flat! All the scientists have conspired to keep this lie from the people of the world. The Modern Astronomy Is inconsistent and the Doctrine of Spherical earth is nothing but an elaborate hoax.
At-least, that is what the people of this "Flat earth society", believe so.
The Flat Earth Society (or) The International Flat Earth Research Society is an organization which was established with an aim to expand the idea that Earth is FLAT. As, crazy as this may seem to us, this organization has been around for 200 years and is very active to this day !

How did it all start?
The idea of Flat earth is something that has been there from many centuries. It was very prevalent and was the accepted idea of the society before 4th

July 25, 2014

Factorial of a number in C & C++ | The Simplest Way

Factorial of a number is a very commonly used function and so, not surprisingly programmers run in to this quite often. But, there is no direct function we can call to do this for us. So, each time i have to use this, i end up writing a 5-10 line code using recursion or some other method and then call that for the factorial, which is pretty boring.

But, I have found a very easy way to implement factorial with a built-in function of "math.h" called tgamma(). So, lets see how to implement this program
#include <math.h>
#include <stdio.h>

double fact(double x)
  return tgamma(x+1);
int main()

June 25, 2014

What is wattless current? | Target GATE 2015 | ECE | EEE | EIE

Watt-less Current?
Watt is the unit of power. So, whenever power is absorbed by an element it is measured in Watts.
So, for example, when a current flows through a Resistor, the Power is dissipated as heat. So, when current flows through a resistive element some power is dissipated, measured in Watts.
So, Now, as you might expect, Watt-less current is the current which doesn't dissipate any power. How, is that possible you ask, lets see how.
The Power in an AC Circuit is given by the following relation. P = V.I.Cos(Ø)
Ø, being the phase angle between Applied voltage and the Alternating Current.
The Quantity Cos(Ø) is also called as Power Factor.
The Phase angle, Ø, is zero for Resistors.

June 18, 2014

Solution | Question of the Day 1 | GATE - 2015 | ECE | EEE

Actual Question - Click here
In the given circuit the input is an Voltage source which has a value of 10.u(t), where u(t) is the Unity Step Function.  The Resistance of the Resistor is 1 Ohm. And, two capacitors of 3F and 2F and connected in series to this Resistor as shown in the figure. Find the voltage across the 2F capacitor as a function of time, V(t).
Assume the Capacitors are initially carrying zero charge.

Answer : V(t)=6 - 6.e^(-5/6 t)
So, That was the question and the answer. Before you proceed to solving the question, there are a few things you need to take a look at.
  1. Laplace Transforms & Inverse Laplace Transforms
  2. Basic Circuit relations (KVL, KCL, Voltage Division, Current Division)
  3. Basics of RL, RC, RLC circuits