7.09.2013

Bridge

A bridge segment or divide a network to isolate traffic related problem.

A bridge sends the data frames only to the concerned segment.

Bridges are used to connect dis-similar network like ethernet system to Token Ring-System. Thus bridge used to join network using CSMA/CD access and token passing access.

Bridge in Networking
Figure: Bridge in Networking 

Bridge are both hardware and software devices.

7.08.2013

Hub

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

Hub is hardware devices.


Hubs in Computer Networking
Figure: Hubs in computer networking

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

Random Number Pyramid

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++)
 {

7.03.2013

Diamond Pattern C program

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

4
434
43234
4321234
43234
434
4

Ans.

/*c program for diamond pattern*/
#include<stdio.h>
int main()
{
 int num,r,c,z,n,nm,no;
 printf("Enter max. number : ");
 scanf("%d", &num);
 nm = num+1;
 for(r=1; r<=num; r++,nm--)
 {
  for(c=1,n=num; c<=r; c++,n--)
     printf("%d",n);
  for(z=nm,c=1; c<r; c++,z++)
     printf("%d",z);
  printf("\n");
 }

Number Triangle

Q. Write a C program to print the following number triangle/pyramid program:

1
12
123
1234
123
12
1

Ans.

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

Number-Character Pattern

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

1111111
1A1AAAA
1AA1AAA
1AAA1AA
1AAAA1A
1AAAAA1
1111111

Ans.

/*c program for number-character pattern*/
#include<stdio.h>
int main()
{
 int num=7,r,c,z;
 printf("1111111\n");
 for(r=1; r<=5; r++)
 {
  for(c=1; c<=num; c++)
  {

Odd Number Pyramid

Q. Write a C program to print the following odd number pyramid as:

1
3 5
5 7 9
7 9 11 13

Ans.

/*c program for odd number pyramid*/
#include<stdio.h>
int main()
{
 int num,r,c,z=1,p;
 printf("Enter no. of rows : ");
 scanf("%d", &num);
 for(r=1; r<=num; r++,z=z+2)
 {
  for(c=1,p=z; c<=r; c++,p=p+2)
      printf(" %d",p);
  printf("\n");
 }