‘C’ Programming: Pseudocodes

ImageHi friends! Am back with my next article following from where I left it the other day.
As we discussed, systematic approach to any task gets it simple to complete. I would again suggest you to note down every step as you start your programming in 'C' and further you can leave it as per your personal requirements.
I had asked you to try to solve the problem without any third variable. Here comes the solution:
Say x=5 & y=9, now if we add x and y such that:
x=x+y, i.e. now x is 14
y=x-y, the value of y is now 14-9=5. Again,
x=x-y so the value of x will be now 14-5=9, and that's our answer.
Hope you could write the same very steps in form of pseudo code(algorithm) now.
Let's take another example because examples are better to understand and get the concept.
Solving a quadratic equation, we deal with the coefficients of x2, x and the constant value. In 'C' we cant give the quadratic equation directly in its original form say, ax2+bx+c=0, either we could give the input in form of its coefficients i.e. a, b & c.
As we know that in a quadratic equation the solution depends on the value of d(discriminant).
So, let's start our pseudo coding:
1. START
2. Read a, b, c (we don't use and or '&', '&' has its own meaning in 'C')
3. d=b2-4ac (we will write it as d=b*b-4*a*c for easy implementation in 'C')
4. If d<0, print "The given equation has imaginary roots". GOTO 7
5. If d=0, print "Equal roots with x=-b/2c" (written as b/(2*c)), GOTO 7
6. If d>0, print "Real and unequal roots as x=(-b+sqrt(d))/(2*a) and x=(-b-sqrt(d))/(2*a)"
7. STOP
Here you might be thinking about the use of 'GOTO', let me make it clear for you all in solving a quadratic equation the answer comes depending on the value of 'd'. When d<0 the roots are imaginary and our solution ends there so we need to write 'STOP' right after it. Its same when d>0 or d=0, so by not writing stop after every interval we just wrote it once and diverted the program statement to it.
On this point I would like to share my personal experience in class. when the teacher asked us to write the algorithm to solve a given quadratic equation, I gave the input as whole equation in its original form and was confused that why are we writing a, b and c only. Similarly I also missed the 'GOTO' statements which means all the three statement lines will be checked before proceeding.
Let's take another simple but interesting example. How would you print the largest number among three given numbers?
Say a=13, b=7, c=21. Clearly by looking we can see that c is the greatest amongst all with a to follow and then c.
But have you thought how the machine will proceed to it? In what sequence will it solve the problem?
Let's go on for the algorithm for now you'all must be able to understand it.
1. START
2. Read x, y, z
3. If a>b
{
If a>c print "a is the greatest"
else print "c is the greatest"
` }
else
{
If b>c print "b is the greatest"
else print "c is the greatest"
` }
4. STOP
Here I used another style for writing it using conditional(If) branching. Hope you'll get to it till next time. You are warmly welcome to comment with your doubts, comments and suggestions. And for you to do, Try writing an algorithm to print the largest number without using branching and also when you don't know the number of variables. You could also try to write it in both the ways which I showed today. Give it a try because you can't succeed until you try. All the very best, believe me its very simple to program when you know the basics, you can't do anything with the rules.
For any previous knowledge refer my last post.

‘C’ Programming Tutorials: Introduction

C-ProgrammersHi everyone! I am Nilesh and this is my first article on this blog. Here I am going to give ‘C’ tutorials and gonna teach you to write some programs which would further help you in your hacking stuff!
‘C’ as we all must have heard is a very versatile language and so is highly followed. The major languages in current time is directly and indirectly based on the concepts of ‘C’. Whether its c++, c#, Unix ‘c’,python, java and so on. Please don’t get afraid of the names as we’ll discuss their basic difference latter which you will feel to be quite negotiable.
Mean while am starting with ‘C’ because as I already said if you know ‘C’ then you can deal with all other major programming languages used globally. Continue reading

Disable Keyboard Using a Batch File.

Disable-KeyboardHello guys, today I am gonna provide you with a simple batch file (.bat extension) which will disable your keyboard after you run it on your system. You can send this to any victim by an email attachment or by means of something else and once he runs the program, his keyboard will not respond to the any keystroke. In one of my previous article I have described few things about batch files/batch viruses so I suggest you to take a look over “How to make a simple batch file virus“ before you start reading this!

As I have promised, I have come up with this article to keep my promise. Basically a batch file is a simple set of commands which you usually type in you command prompt. These files are never treated as a virus hence you can take advantage of them. Even though they are not really any virus they create a devastating damage to your operating system!  Continue reading

Website Hacking by SQL Injection – With an example

sql_injectionHey guys! I have taken such a long time delivering you with some information, so today I thought to teach you some interesting stuff. There are over 30 million of sites available on internet and 16% of them are highly vulnerable to SQL injection attack. In this article I will teach you what exactly is SQL injection, how it works and how to perform. I have already taught you some basics in my last article. I advice you to take a look at my previous article before you continue reading this.

Today we are gonna access the database of a European site http://www.adas-fusion.eu/

Recently I have found a link vulnerable to SQL injection.

Read on…. Continue reading