C Programming

C Programming


Number Decrease to Zero Triangle

Posted: 25 Jan 2014 10:07 AM PST

Q. Write a C program to print the following number decrease to zero triangle pattern as:

     0
    101
   21012
  3210123
 432101234

Ans.

/*c program for number decrease triangle*/
#include<stdio.h>
int main()
{
 int num,r,c,sp;
 printf("Enter max number : ");
 scanf("%d", &num);
 for(r=0; r<=num; r++)
 {
   for(sp=r; sp<num; sp++)
       printf(" ");
   for(c=r; c>=0; c--)
       printf("%d",c);
   for(c=1; c<=r; c++)
       printf("%d",c);
   printf("\n");
 }
 getch();
 return 0;
}

/************************************************************
The output of above program would be:
************************************************************/

Output of Number Decrease to Zero Triangle C program
Figure: Screen shot for Number Decrease to Zero Triangle C program

What is Computer Generation

Posted: 25 Jan 2014 08:50 AM PST

In last post we read about what is computer. From Abcus to modern computer timing is called to computer generation. Each computer generation have specific features, and these features are more advances then those computer goes to higher computer generation.

There are five computer generation as:

  1. First Generation (1946-1959)
  2. Second Generation (1959-1965)
  3. Third Generation (1965-1971)
  4. Fourth Generation (1971-1985)
  5. Fifth Generation (1985- now)
We'll discuss each computer generation detailed in next post.

What is Computer

Posted: 25 Jan 2014 09:21 AM PST

In today's life, computer is essential part of human life. Computer is so powerful system that do the all type works and decrease the human life problem and increase effective, easy and reliable life.

The word "computer" comes from counting i.e. we can divide word computer in 2 words: compute + er
in other word we can say computer is a machine that can compute all countable thing.

But only countable machine, is it computer?
Absolutely not, because in modern era computer do almost all the stuff of world.

So according to Oxford dictionary:

"Computer is an automatic electronic apparatus for making calculations or controlling operations that are expressible in numerical or logical terms."

in other word, we can say:

"Computer is an electronic apparatus that takes data and instruction from user then as input, process them and give the accordingly result as output."

Input -> Process -> Output

The first apparatus that is makes for computing is named: "Abacus"
It is made in Chaina. Abacus perform only addition and subtraction to do all the computing work. It was too interesting that is uses long time in human life, till the modern computer not comes.

From Abacus to modern computer timing, we divided in five parts, that is called "Computer Generation."


Post a Comment