You are on page 1of 25

Case study of various routing algorithm

a router is used to manage network traffic and find the best route for sending packets.
But have you ever thought about how routers do this? Routers need to have some
information about network status in order to make decisions regarding how and where
to send packets. But how do they gather this information?
Routers use routing algorithms to find the best route to a destination. When we say
"best route," we consider parameters like the number of hops (the trip a packet takes
from one router or intermediate point to another in the network), time delay and
communication cost of packet transmission.


Based on how routers gather information about the structure of a network and their
analysis of information to specify the best route, we have two major routing algorithms:
global routing algorithms and decentralized routing algorithms. In decentralized
routing algorithms, each router has information about the routers it is directly connected
to -- it doesn't know about every router in the network. These algorithms are also known
as DV (distance vector) algorithms

Dijkstra's algorithm



Dijkstra's algorithm runtime
Dijkstra's algorithm, conceived by Dutch computer scientist Edsger Dijkstra in
1959,
[1]
is a graph search algorithm that solves the single-source shortest path
problem for a graph with nonnegative edge path costs, producing a shortest path
tree. This algorithm is often used in routing. An equivalent algorithm was
developed by Edward F. Moore in 1957.
[2]

For a given source vertex (node) in the graph, the algorithm finds the path with
lowest cost (i.e. the shortest path) between that vertex and every other vertex. It
can also be used for finding costs of shortest paths from a single vertex to a single
destination vertex by stopping the algorithm once the shortest path to the
destination vertex has been determined. For example, if the vertices of the graph
represent cities and edge path costs represent driving distances between pairs of
cities connected by a direct road, Dijkstra's algorithm can be used to find the
shortest route between one city and all other cities. As a result, the shortest path
first is widely used in network routing protocols, most notably IS-IS and OSPF
(Open Shortest Path First).

Algorithm
Let the node we are starting be called an initial node. Let a distance of a node Y
be the distance from the initial node to it. Dijkstra's algorithm will assign some
initial distance values and will try to improve them step-by-step.
1. Assign to every node a distance value. Set it to zero for our initial node and
to infinity for all other nodes.
2. Mark all nodes as unvisited. Set initial node as current.
3. For current node, consider all its unvisited neighbours and calculate their
distance (from the initial node). For example, if current node (A) has
distance of 6, and an edge connecting it with another node (B) is 2, the
distance to B through A will be 6+2=8. If this distance is less than the
previously recorded distance (infinity in the beginning, zero for the initial
node), overwrite the distance.
4. When we are done considering all neighbours of the current node, mark it
as visited. A visited node will not be checked ever again; its distance
recorded now is final and minimal.
5. Set the unvisited node with the smallest distance (from the initial node) as
the next "current node" and continue from step 3.
Description of the algorithm
Suppose you're marking over the streets on a street map (tracing the street with a
marker) in a certain order, until you have a route marked in from the starting point
to the destination. The order is conceptually simple: from all the street intersections
of the already marked routes, find the closest unmarked intersection - closest to the
starting point (the "greedy" part). It's the whole marked route to the intersection,
plus the street to the new, unmarked intersection. Mark that street to that
intersection, draw an arrow with the direction, then repeat. Never mark any two
intersections twice. When you get to the destination, follow the arrows backwards.
There will be only one path back against the arrows, the shortest one.


BELLman ford Algorithms
DV algorithms are also known as Bellman-Ford routing algorithms and Ford-Fulkerson


routing algorithms. In these algorithms, every router has a routing table that shows it the
best route for any destination. A typical graph and routing table for router J is shown
below.


Destination Weight Line
A 8 A
B 20 A
C 28 I
D 20 H
E 17 I
F 30 I
G 18 H
H 12 H
I 10 I
J 0 ---
K 6 K
L 15 K
A typical network graph and routing table for router J
As the table shows, if router J wants to get packets to router D, it should send them to
router H. When packets arrive at router H, it checks its own table and decides how to
send the packets to D.
In DV algorithms, each router has to follow these steps:
1. It counts the weight of the links directly connected to it and saves the information to its
table.
2. In a specific period of time, it send its table to its neighbor routers (not to all routers) and
receive the routing table of each of its neighbors.
3. Based on the information in its neighbors' routing tables, it updates its own.
One of the most important problems with DV algorithms is called "count to infinity."
Let's examine this problem with an example:
Imagine a network with a graph as shown below. As you see in this graph, there is only
one link between A and the other parts of the network. Here you can see the graph and
routing table of all nodes:


A B C D
A 0,- 1,A 2,B 3,C
B 1,B 0,- 2,C 3,D
C 2,B 1,C 0,- 1,C
D 3,B 2,C 1,D 0,-
Network graph and routing tables
Now imagine that the link between A and B is cut. At this time, B corrects its table. After
a specific amount of time, routers exchange their tables, and so B receives C's routing
table. Since C doesn't know what has happened to the link between A and B, it says
that it has a link to A with the weight of 2 (1 for C to B, and 1 for B to A -- it doesn't know
B has no link to A). B receives this table and thinks there is a separate link between C
and A, so it corrects its table and changes infinity to 3 (1 for B to C, and 2 for C to A, as
C said). Once again, routers exchange their tables. When C receives B's routing table, it
sees that B has changed the weight of its link to A from 1 to 3, so C updates its table
and changes the weight of the link to A to 4 (1 for C to B, and 3 for B to A, as B said).
This process loops until all nodes find out that the weight of link to A is infinity. This
situation is shown in the table below. In this way, experts say DV algorithms have a
slow convergence rate.


B C D
Sum of weight to A after link cut ,A 2,B 3,C
Sum of weight to B after 1st updating 3,C 2,B 3,C
Sum of weight to A after 2nd updating 3,C 4,B 3,C
Sum of weight to A after 3rd updating 5,C 4,B 5,C
Sum of weight to A after 4th updating 5,C 6,B 5,C
Sum of weight to A after 5th updating 7,C 6,B 7,C
Sum of weight to A after nth updating ... ... ...


The "count to infinity" problem
One way to solve this problem is for routers to send information only to the neighbors
that are not exclusive links to the destination. For example, in this case, C shouldn't send
any information to B about A, because B is the only way to A.




Q2. To study different type of LAN equipment?
Ans: LAN equipments

For making LAN we may require some or the entire following hardware category.
Along with these are shown the OSI level of these equipments:

1. Transmission media (Physical level)
2. Hub (Physical level)
3. Switches (Data link level)
4. Routers (Network level)
5. Gateways (Application level)
1.Transmission media:

A transmission medium (plural transmission media) is a material substance
(solid, liquid, gas, or plasma) that can propagate energy waves. For example, the
transmission medium forsound received by the ears is usually air, but solids and liquids
may also act as transmission media for sound. The term transmission medium can
also refer to a technical device that employs the material substance to transmit or guide
waves. Thus, an optical fiber or a copper cable is referred to as a transmission medium.
Guided Transmission Media uses a "cabling" system that guides the data signals along
a specific path. The data signals are bound by the "cabling" system. Guided Media is
also known as Bound Media. Cabling is meant in a generic sense in the previous
sentences and is not meant to be interpreted as copper wire cabling only.
Unguided Transmission Media consists of a means for the data signals to travel but
nothing to guide them along a specific path. The data signals are not bound to a cabling
media and as such are often called Unbound Media.
2.Hub:
A common connection point for devices in a network. Hubs are commonly used to
connect segments of a LAN. A hub contains multiple ports. When apacket arrives at one
port, it is copied to the other ports so that all segments of the LAN can see all packets.
A passive hub serves simply as a conduit for the data, enabling it to go from one device
(or segment) to another. So-called intelligent hubs include additional features that
enables an administrator to monitor the traffic passing through the hub and to configure
each port in the hub. Intelligent hubs are also called manageable hubs.

3.Switch:
A network switch or switching hub is a computer networking device that connects network
segments.The term commonly refers to a multi-port network bridge that processes and routes
data at the data link layer (layer 2) of the OSI model. Switches that additionally process data at
the network layer (Layer 3) and above are often referred to as Layer 3 switches or multilayer
switches.The term network switch does not generally encompass unintelligent or passive
network devices such as hubs and repeaters.
The network switch plays an integral part in most modern Ethernet local area networks (LANs).
Mid-to-large sized LANs contain a number of linked managed switches. Small office/home
office (SOHO) applications typically use a single switch, or an all-purpose converged
device such as a gateway to access small office/home broadband services such
as DSL or cable internet. In most of these cases, the end-user device contains a router and
components that interface to the particular physical broadband technology. User devices may
also include a telephone interface for VoIP.

4. Routers:
A router is a device that forwards data packets across computer networks. Routers
perform the data "traffic directing" functions on theInternet. A router is a microprocessor-
controlled device that is connected to two or more data lines from different networks.
When a data packet comes in on one of the lines, the router reads the address
information in the packet to determine its ultimate destination. Then, using information in
its routing table, it directs the packet to the next network on its journey. A data packet is
typically passed from router to router through the networks of the Internet until it gets to
its destination computer. Routers also perform other tasks such as translating the data
transmission protocol of the packet to the appropriate protocol of the next network, and
preventing unauthorized access to a network by the use of a firewall.
[1]

5.Gateways:
A gateway may contain devices such as protocol translators, impedance matching devices,
rate converters, fault isolators, or signaltranslators as necessary to
provide system interoperability. It also requires the establishment of mutually acceptable
administrative procedures between both networks.
A protocol translation/mapping gateway interconnects networks with different network
protocol technologies by performing the required protocol conversions.
Gateways, also called protocol converters, can operate at network layer and above. The job
of a gateway is much more complex than that of a router or switch

Q6. To study and configure various type of routers
and bridge?
Ans: A router is a device that forwards data packets across computer networks. Routers perform the
data "traffic directing" functions on the Internet. A router is a microprocessor-controlled device that is
connected to two or more data lines from different networks. When a data packet comes in on one of the
lines, the router reads the address information in the packet to determine its ultimate destination. Then,
using information in its routing table, it directs the packet to the next network on its journey. A data packet
is typically passed from router to router through the networks of the Internet until it gets to its destination
computer. Routers also perform other tasks such as translating the data transmission protocol of the
packet to the appropriate protocol of the next network, and preventing unauthorized access to a network
by the use of a firewall.
[1]

Types of Routers
There are several types of routers that you will want to understand. You need to know the
difference so that you can set up your network or at least so that you can understand what
the local computer guy tells you to do.
1.Broadband Routers
Broadband routers can be used to do several different types of things. They can be used to
connect two different computers or to connect two computers to the Internet. They can also
be used to create a phone connection.
If you are using Voice over IP (VoIP) technology, then you will need a broadband router to
connect your Internet to your phone. These are often a special type of modem that will have
both Ethernet and phone jacks. Although this may seem a little confusing, simply follow the
instructions that your VoIP provider sends with your broadband router - usually you must
purchase the router from the company in order to obtain the service.
2.Wireless Routers
Wireless routers connect to your modem and create a wireless signal in your home or
office. So, any computer within range can connect to your wireless router and use your
broadband Internet for free. The only way to keep anyone from connecting to your system is
to secure your router.
A word of warning about wireless routers: Be sure your secure them, or you will be
susceptible to hackers and identity thieves. In order to secure your router, you simply need
to come to WhatIsMyIPAddress.com, and get your IP address. Then, you'll type that into
your web browser and log into your router (the user ID and password will come with your
router).

Types of bridges
There are six main types of bridges: beam bridges, cantilever bridges, arch bridges, suspension
bridges, cable-stayed bridges.
1.Beam bridges
Beam bridges are horizontal beams supported at each end by abutments, hence their structural name
of simply supported. When there is more than one span the intermediate supports are known as piers.
The earliest beam bridges were simple logs that sat across streams and similar simple structures. In
modern times, beam bridges are large box steel girder bridges. Weight on top of the beam pushes
straight down on the abutments at either end of the bridge.
[11]
They are made up mostly of wood or metal.
Beam bridges typically do not exceed 250 feet (76 m) long. The longer the bridge, the weaker. The
world's longest beam bridge is Lake Pontchartrain Causeway in southern Louisiana in the United States,
at 23.83 miles (38.35 km), with individual spans of 56 feet (17 m).
[12]

2.Cantilever bridges
Cantilever bridges are built using cantilevershorizontal beams that are supported on only one end. Most
cantilever bridges use a pair ofcontinuous spans extending from opposite sides of the supporting piers,
meeting at the center of the obstacle to be crossed. Cantilever bridges are constructed using much the
same materials & techniques as beam bridges. The difference comes in the action of the forces through
the bridge. The largest cantilever bridge is the 549-metre (1,801 ft) Quebec Bridge in Quebec, Canada.

3.Arch bridges
Arch bridges have abutments at each end. The earliest known arch bridges were built
by the Greeks and include the Arkadiko Bridge. The weight of the bridge is thrust into
the abutments at either side. Dubai in the United Arab Emirates is currently building
the Sheikh Rashid bin Saeed Crossing which is scheduled for completion in 2012. When completed, it will
be the largest arch bridge in the world.
[13]


4.Suspension bridges
Suspension bridges are suspended from cables. The earliest suspension bridges were made of ropes or
vines covered with pieces of bamboo. In modern bridges, the cables hang from towers that are attached
to caissons or cofferdams. The caissons or cofferdams are implanted deep into the floor of a lake or river.
The longest suspension bridge in the world is the 12,826 feet (3,909 m) Akashi Kaikyo Bridge in
Japan.
[14]
Seesimple suspension bridge, stressed ribbon bridge, underspanned suspension
bridge, suspended-deck suspension bridge, and self-anchored suspension bridge.

5.Cable-stayed bridges
Cable-stayed bridges, like suspension bridges, are held up by cables. However, in a cable-stayed bridge,
less cable is required and the towers holding the cables are proportionately shorter.
[15]
The first known
cable-stayed bridge was designed in 1784 by C.T. Loescher.
[16]
The longest cable-stayed bridge is
the Sutong Bridge over the Yangtze River in China.









Q7:implement various routing protocol algorithms?
Distance vector routing algo:
#include<stdio.h>
#include<ctype.h>
int graph[12][12];
int e[12][12];
int ad[12];
int no,id,adc,small,chosen;
char nodes[12]={a b c d e f g h i j k l};
int main()
{
int i,j,k,ch1,ch2=0;
adc=0;
printf("enter the no nodes");
scanf("%d",&no);
printf("enter the value for adjacency matrix");
for(i=0;i<no;i++)
{
for(j=0;j<no;j++)
{
printf(" enter values for %d,%d position:",(i+1),(j+1));
scanf("%d",&graph[i][j]);
}
}
printf("enter initial estimates");
for(i=0;i<no;i++)
{
printf("estimate for node %c \n",nodes[i]);
for(j=0;j<no;j++)
{
printf("to node%c",nodes[j]);
scanf("%d",&e[i][j]);
}
}
do
{
printf("\n menu:\n 1.routing info for node");
printf("2.estimated table\n ");
scanf("%d",&ch1);
switch(ch1)
{
case 1:
printf("\n which node should routing table be built(1-a)(2-b)...");
scanf("%d",&id);
id--;
adc=0;
printf("neighbours for particular node");
for(i=0;i<no;i++)
{
if(graph[id][i]==1)
{
ad[adc]=i;
adc++;
printf("%c",nodes[i]);
}
}
for(i=0;i<no;i++)
{
if(id!=i)
{
small=100;
chosen=-1;
for(j=0;j<adc;j++)
{
int total=e[ad[j]][i]+e[id][ad[j]];
if(total<small)
{
small=total;
chosen=j;
} }
e[id][i]=small;
printf("\n shortest estimate to %c is %d",nodes[i],small);
printf("\n next hop is %c",nodes[ad[chosen]]);
} else
e[id][i]=0;
}
break;
case 2:
printf("\n");
for(i=0;i<no;i++)
{ for(j=0;j<no;j++)
printf("%d",e[i][j]);
printf("\n");
} break;
}
printf("\n do u want to continue (1-yes,2-no)");
scanf("%d",&ch2);
}
while(ch2==1);
return 0; #include<stdio.h>
#include<ctype.h>
int graph[12][12];
int e[12][12];
int ad[12];
int no,id,adc,small,chosen;
char nodes[12]={a b c d e f g h i j k l};
int main()
{
int i,j,k,ch1,ch2=0;
adc=0;
printf("enter the no nodes");
scanf("%d",&no);
printf("enter the value for adjacency matrix");
for(i=0;i<no;i++)
{
for(j=0;j<no;j++)
{
printf(" enter values for %d,%d position:",(i+1),(j+1));
scanf("%d",&graph[i][j]);
}
}
printf("enter initial estimates");
for(i=0;i<no;i++)
{
printf("estimate for node %c \n",nodes[i]);
for(j=0;j<no;j++)
{
printf("to node%c",nodes[j]);
scanf("%d",&e[i][j]);
}
}
do
{
printf("\n menu:\n 1.routing info for node");
printf("2.estimated table\n ");
scanf("%d",&ch1);
switch(ch1)
{
case 1:
printf("\n which node should routing table be built(1-a)(2-b)...");
scanf("%d",&id);
id--;
adc=0;
printf("neighbours for particular node");
for(i=0;i<no;i++)
{
if(graph[id][i]==1)
{
ad[adc]=i;
adc++;
printf("%c",nodes[i]);
}
}
for(i=0;i<no;i++)
{
if(id!=i)
{
small=100;
chosen=-1;
for(j=0;j<adc;j++)
{
int total=e[ad[j]][i]+e[id][ad[j]];
if(total<small)
{
small=total;
chosen=j;
} }
e[id][i]=small;
printf("\n shortest estimate to %c is %d",nodes[i],small);
printf("\n next hop is %c",nodes[ad[chosen]]);
} else
e[id][i]=0;
}
break;
case 2:
printf("\n");
for(i=0;i<no;i++)
{ for(j=0;j<no;j++)
printf("%d",e[i][j]);
printf("\n");
} break;
}
printf("\n do u want to continue (1-yes,2-no)");
scanf("%d",&ch2);
}
while(ch2==1);
return 0;
}
Dijkstras algo:
#include <stdio.h>
#define MAX 7
#define INFINITE 998
int allselected(int *selected)
{
int i;
for(i=0;i<MAX;i++)
if(selected[i]==0)
return 0;return 1;
}
void shortpath(int cost[][MAX],int *preced,int *distance)
{
int selected[MAX]={0};
for(i=0;i<MAX;i++)
distance[0]=0;
current=0;
while(!allselected(selected))
{
smalldist=INFINITE;
dc=distance[current];
for(i=0;i<MAX;i++)
{
if(selected[i]==0)
{
newdist=dc+cost[current][i];
if(newdist<distance[i])
distance[i]=newdist;
preced[i]=current;
}
if(distance[i]<smalldist) {
smalldist=distance[i];
k=i;
} }
}
current=k;
selected[current]=1;
}}

int main()
{

intcost[MAX][MAX]={{INFINITE,2,4,7,INFINITE,5,INFINITE},{2,INFINITE,INFINITE,6,3,
INFINITE,8},{4,INFINITE,INFINITE,INFINITE,INFINITE,6,INFINITE},{7,6,INFINITE,INFI
NITE,INFINITE,1,6},{INFINITE,3,INFINITE,INFINITE,INFINITE,INFINITE,7},{5,INFINIT
E,6,1,INFINITE,INFINITE,6},{INFINITE,8,INFINITE,6,7,6,INFINITE}};

int i,preced[MAX]={0},distance[MAX];
shortpath(cost,preced,distance);
for(i=0;i<MAX;i++)
printf("%d\n",distance[i]);
return 0;
}


Bell-man ford algo:
#include <stdio.h>
typedef struct {
int u, v, w;
} Edge;

int n; /* the number of nodes */
int e; /* the number of edges */
Edge edges[1024]; /* large enough for n <= 2^5=32 */
int d[32]; /* d[i] is the minimum distance from node s to node i */
#define INFINITY 10000
void printDist()
{
int i;
printf("Distances:\n");
for (i = 0; i < n; ++i)
printf("to %d\t", i + 1);
printf("\n");
for (i = 0; i < n; ++i)
printf("%d\t", d[i]);
printf("\n\n");
}
void bellman_ford(int s) {
int i, j;
for (i = 0; i < n; ++i)
d[i] = INFINITY;
d[s] = 0;
for (i = 0; i < n - 1; ++i)
for (j = 0; j < e; ++j)
if (d[edges[j].u] + edges[j].w < d[edges[j].v])
d[edges[j].v] = d[edges[j].u] + edges[j].w;
}

int main(int argc, char *argv[]) {
int i, j;
int w;
FILE *fin = fopen("dist.txt", "r");
fscanf(fin, "%d", &n);
e = 0;
for (i = 0; i < n; ++i)
for (j = 0; j < n; ++j) {
fscanf(fin, "%d", &w);
if (w != 0) {
edges[e].u = i;
edges[e].v = j;
edges[e].w = w;
++e;
}}
fclose(fin);
/* printDist(); */

bellman_ford(0);
printDist();
return 0;
}















Q8. Study and implemantation of VOI P concept?
Ans: Voice over Internet Protocol (Voice over IP, VoIP) is one of a family of internet
technologies, communication protocols, and transmission technologies for delivery of voice
communications and multimedia sessions over Internet Protocol (IP) networks, such as the Internet.
Other terms frequently encountered and often used synonymously with VoIP are IP telephony, Internet
telephony, voice over broadband (VoBB),broadband telephony, and broadband phone.
Internet telephony refers to communications servicesvoice, fax, SMS, and/or voice-messaging
applicationsthat are transported via the Internet, rather than the public switched telephone
network (PSTN). The steps involved in originating a VoIP telephone call are signaling and media channel
setup, digitization of the analog voice signal, encoding, packetization, and transmission as Internet
Protocol (IP) packets over a packet-switched network. On the receiving side, similar steps (usually in the
reverse order) such as reception of the IP packets, decoding of the packets and digital-to-analog
conversion reproduce the original voice stream.
[1]

VoIP systems employ session control protocols to control the set-up and tear-down of calls as well
as audio codecs which encode speech allowing transmission over an IP network as digital audio via
an audio stream. The codec used is varied between different implementations of VoIP (and often a range
of co
decs are used); some implementations rely on narrowband and compressed speech, while others
support high fidelity stereo codecs.
There are three types of VoIP tools that are commonly used; IP Phones,Software VoIP and Mobile and
Integrated VoIP. The IP Phones are the most institutionally established but still the least obvious of the
VoIP tools. Of all the software VoIP tools that exist, Skype is probably the most easily identifiable. The
use of software VoIP has increased during the global recession as many persons, looking for ways to cut
costs have turned to these tools for free or inexpensive calling or video conferencing applications.
Software VoIP can be further broken down into three classes or subcategories; Web Calling, Voice and
Video Instant Messaging and Web Conferencing. Mobile and Integrated VoIP is just another example of
the adaptability of VoIP. VoIP is available on many smartphones and internet devices so even the users
of portable devices that are not phones can still make calls or send SMS text messages over 3G or
WIFI.
[2]

H.323
IP Multimedia Subsystem (IMS)
Media Gateway Control Protocol (MGCP)
Session Initiation Protocol (SIP)
Real-time Transport Protocol (RTP)
Session Description Protocol (SDP)
The H.323 protocol was one of the first VoIP protocols that found
widespread implementation for long-distance traffic, as well as local area
network services. However, since the development of newer, less
complex protocols, such as MGCP and SIP, H.323 deployments are
increasingly limited to carrying existing long-haul network traffic. In
particular, the Session Initiation Protocol (SIP) has gained widespread
VoIP market penetration.
A notable proprietary implementation is the Skype protocol, which is in
part based on the principles of Peer-to-Peer (P2P) networking.


Q10 Write down the 2 cryptography algo and comparison
b/w them?opAns: RSA:
#include< stdio.h>
#include< conio.h>

int phi,M,n,e,d,C,FLAG;

int check()
{
int i;
for(i=3;e%i==0 && phi%i==0;i+2)
{
FLAG = 1;
return;
}
FLAG = 0;
}

void encrypt()
{
int i;
C = 1;
for(i=0;i< e;i++)
C=C*M%n;
C = C%n;
printf("\n\tEncrypted keyword : %d",C);
}

void decrypt()
{
int i;
M = 1;
for(i=0;i< d;i++)
M=M*C%n;
M = M%n;
printf("\n\tDecrypted keyword : %d",M);
}

void main()
{
int p,q,s;
clrscr();
printf("Enter Two Relatively Prime Numbers\t: ");
scanf("%d%d",&p;,&q;);
n = p*q;
phi=(p-1)*(q-1);
printf("\n\tF(n)\t= %d",phi);
do
{
printf("\n\nEnter e\t: ");
scanf("%d",&e;);
check();
}while(FLAG==1);
d = 1;
do
{
s = (d*e)%phi;
d++;
}while(s!=1);
d = d-1;
printf("\n\tPublic Key\t: d,%d}",e,n);
printf("\n\tPrivate Key\t: d,%d}",d,n);
printf("\n\nEnter The Plain Text\t: ");
scanf("%d",&M;);
encrypt();
printf("\n\nEnter the Cipher text\t: ");
scanf("%d",&C;);
decrypt();
getch();
}

You might also like