Friday, January 31, 2014

First Computer Generation

The first computer comes since 1946 named ENIAC. ENIAC stand for Electronic Numerical Integrator And Calculator. ENIAC invented by J.P.Eckert and J.W.Mauchiy. The characteristic of first computer generation is as following:

  • The first generations computers used Vacuum Tube or Diode Valve.
  • The first generations computers works on the machine language i.e. all working is done with 0 and 1.
  • The first generation computers used magnetic drums or punch card for storage the data.
  • The first generation computers is too large in size so too difficult to transport for one palace to another.
  • The first generation computers consumes too much electricity.
  • Example of first generation computers: UNIVAC, ENIAC

Wednesday, January 29, 2014

Decrease Character Pyramid

Q. Write a C program to print the following decrease character pyramid as:

EEEEE
DDDD
CCC
BB
A

Ans.

/*c program for decrease number pyramid*/
#include<stdio.h>
int main()
{

 char ch,p,r,c;
 printf("Enter any character : ");
 scanf("%c", &ch);
 if(ch>='a' && ch<='z')
    ch=ch-32;
 p=ch;
 for(r='A'; r<=ch; r++,p--)
 {
   for(c='A'; c<=p; c++)
      printf("%c",p);
   printf("\n");
 }
 getch();
 return 0;
}

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


Output for decrease character pyramid C program
Figure: Screen shot for decrease character pyramid C program

Saturday, January 25, 2014

Number Decrease to Zero Triangle

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

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

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."

Thursday, December 26, 2013

Character Rectangle Structure

Q. Write  a C program to display the following character rectangle structure/pattern/design as:

ABCDEEDCBA
ABCD__DCBA
ABC____CBA
AB______BA
A________A

Ans.

/*c program for character rectangle pattern*/
#include<stdio.h>
int main()
{
 char ch,r='A',c,sp;
 printf("Enter any character : ");
 scanf("%c",&ch);
 if(ch>='a' && ch<='z')
    ch=ch-32;
 printf("\n");
 for(; ch>='A'; ch--,r++)
 {
  for(c='A'; c<=ch; c++)
     printf("%c",c);
  for(sp=r; sp>'A'; sp--)
     printf("__");
  for(c=ch; c>='A'; c--)
     printf("%c",c);
  printf("\n");
 }
 getch();
 return 0;
}

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


Output of character rectangle pattern C program
Figure: Screen shot for character rectangle structure C program


Tuesday, December 10, 2013

Number Rectangle Pattern

Q. Write a C program to print the following number pattern rectangle as:

1 2 3 4 5 4 5
2 3 4 5 3 4 5
3 4 5 2 3 4 5
4 5 1 2 3 4 5

Ans.

/*c program for number pattern rectangle design*/
#include<stdio.h>
int main()
{

 int n=4,num=5,p=4,r,c,z;
 for(r=1; r<=n; r++,p--)
 {
   for(c=r; c<=num; c++)
      printf(" %d",c);
   for(c=1,z=p; c<=r+1; c++,z++)
     printf(" %d",z);
   printf("\n");
 }
 getch();
 return 0;
}

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


Output of Number Rectangle Pattern C program
Figure: Screen-shot for Number Rectangle Pattern C program