C Programming

C Programming


Hub

Posted: 08 Jul 2013 10:01 AM PDT

Hubs are also called "Multi port repeaters" or "concentrators".

Hub is hardware devices.

Hub is similar to repeaters, except that it broadcast data received by any port to tall other parts on the hub.

Hubs are used to provide a physical star topology.

Hubs operators at "Physical layer" in OSI model.

Hubs in Computer Networking
Figure: Hubs in computer networking

Router

Posted: 08 Jul 2013 02:03 AM PDT

A router is special purpose computer, that allows to connect to multiple computer networks.

Routers are hardware & software devices.

Router with Internet and Compter
Figure: Router


Router can connect network segments, and filter and isolate traffic.

Unlike a bridge, a router can connect networks that uses different technology, addressing methods, media types, frame format speeds.

Routers operator at "Network Layer" in OSI (Open Source Interconnection) model.

Random Number Pyramid

Posted: 07 Jul 2013 09:46 PM PDT

Q. Write a C program to print the any entered number, digit pyramid,

For example:

if entered number is : 87954
then output must be as:

87954
7954
954
54
4

Ans.

/*c program for random digit pyramid*/
#include<stdio.h>
int main()
{
 int n[50],i,j=0,k,r,c,len;
 printf("Enter total length of number : ");
 scanf("%d", &len);
 printf("\nNote: Entered digit MUST be single.\n\n");
 for(i=0; i<len; i++)
 {
   printf("Enter %d single digit : ",i+1);
   scanf("%d", &n[i]);
 }
 printf("\n");
 for(r=1; r<=len; r++,j++)
 {
  for(c=r,k=j; c<=len; c++,k++)
     printf("%d",n[k]);
  printf("\n");
 }
 getch();
 return 0;
}

The output of above program would be:


Output of Random Number Pyramid C program
Figure: Screen shot for Random Number Pyramid C program




Post a Comment