1. write a program for this output
n=6
x=1 2 3 4 5
expression is |x-n|
for example |1-6|=5
|2-6|=4
|3-6|=3
|4-6|=2
|5-6|=1 is minimum.
so the output will be 5.
2. write a program for this output
i/p is 1->2->3->4->5->6->7
o/p is 1->5->2->6->3->7->4
n=6
x=1 2 3 4 5
expression is |x-n|
for example |1-6|=5
|2-6|=4
|3-6|=3
|4-6|=2
|5-6|=1 is minimum.
so the output will be 5.
2. write a program for this output
i/p is 1->2->3->4->5->6->7
o/p is 1->5->2->6->3->7->4
No comments:
Post a Comment