You are on page 1of 4

http://www.computerhope.com/jargon/e/extecomm.

htm for external commands


.
http://www.wellesley.edu/Computing/Ofce03/owerpoint03/general.html for power
point .........
#include <stdio.h>
#include<conio.h>
void main()
{
int a[50], n, item, loc, mid, i,beg = 0; end = n!;;
"#int$(%&n'nte# si(e o$ an a##a)* %);
scan$(%+d%, ,n);
"#int$(%&n'nte# elements o$ an a##a) in so#ted $o#m*&n%);
$o#(i=0; i<n; i--)
scan$(%+d%, ,a[i]);
"#int$(%&n'nte# ./'0 to be sea#ched* %);
scan$(%+d%, ,item);
mid = (beg - end) 1 2;
3hile ((beg<=end) ,, (a[mid]4=item))
{
i$ (item < a[mid])
end = mid !;
else
beg = mid - !;
mid = (beg - end) 1 2;
5
i$ (a[mid] == item)
"#int$(%&n&n./'0 $ound at location +d%, mid-!);
else
"#int$(%&n&n./'0 doesn6t e7ist%);
getch();
5
Inline Attachment Follows: bubble sort.txt
#include <stdio.h>
#include<conio.h>
void main()
{
int i,a[50], n 8, 9, tem";
"#int$(%&n'nte# si(e o$ an a##a)* %);
scan$(%+d%, ,n);
"#int$(%&n'nte# elements o$ an a##a)*&n%);
$o#(i=0; i<n; i--)
scan$(%+d%, ,a[i]);

$o#(8=0; 8<n; 8--)
$o#(9=0; 9<(n!)8; 9--)
i$(a[9] > a[9-!])
{
tem" = a[9];
a[9] = a[9-!];
a[9-!] = tem";
5
"#int$(%&n&n:$te# so#ting*&n%);
$o#(i=0; i<n; i--)
"#int$(%&n+d%, a[i]);
getch();
5
Inline Attachment Follows: factorial.txt
#include <stdio.h>
#include<conio.h>
void main()
{
int n, i;
long $act=!;
"#int$(%&n'nte# an) numbe#* %);
scan$(%+d%, ,n);
i=!;
i$(n==o)
"#int$(%+d%,!);
3hile(i<=n)
{
$act = $act;i;
i--;
5
"#int$(%&n<acto#ial = +ld%, $act);
getch();
5
Inline Attachment Follows: linear search.txt
#include <stdio.h>
#include<conio.h>
void main()
{
int a[!0], i, item;
"#int$(%&n'nte# elements o$ an a##a)*&n%);
$o# (i=0; i<==; i --)
scan$(%+d%, ,a[i]);
"#int$(%&n'nte# item to sea#ch* %);
scan$(%+d%, ,item);
$o# (i=0; i<==; i--)
i$ (item == a[i])
{
"#int$(%&n.tem $ound at location +d%, i-!);
b#ea9;
5
i$ (i > =)
"#int$(%&n.tem doesnot e7ist.%);
getch();
5
Inline Attachment Follows: matrix add.txt
#include <stdio.h>
#include<conio.h>
void main()
{
int a[!0][!0], b[!0][!0], c[!0][!0], i, 8, #o3, col;
cl#sc#();
"#int$(%&n'nte# numbe# o$ #o3s and columns* %);
scan$(%+d +d%, ,#o3, ,col);
"#int$(%&n'nte# elements o$ :##a) :*&n%);
$o# (i=0; i<#o3; i--)
$o# (8=0; 8<col; 8--)
scan$(%+d%, ,a[i][8]);
"#int$(%&n'nte# elements o$ :##a) >*&n%);
$o# (i=0; i<#o3; i--)
$o# (8=0; 8<col; 8--)
scan$(%+d%, ,b[i][8]);
"#int$(%&n'lements o$ 0at#i7 :*&n&n%);
$o# (i=0; i<#o3; i--)
{
$o# (8=0; 8<col; 8--)
"#int$(%&t+d%, a[i][8]);
"#int$(%&n&n%);
5
"#int$(%&n'lements o$ 0at#i7 >*&n&n%);
$o# (i=0; i<#o3; i--)
{
$o# (8=0; 8<col; 8--)
"#int$(%&t+d%, b[i][8]);
"#int$(%&n&n%);
5
$o# (i=0; i<#o3; i--)
$o# (8=0; 8<col; 8--)
c[i][8] = a[i][8] - b[i][8];
"#int$(%&n0at#i7 :ddition is*&n&n%);
$o# (i=0; i<#o3; i--)
{
$o# (8=0; 8<col; 8--)
"#int$(%&t+d%, c[i][8]);
"#int$(%&n%);
5
getch();
5
Inline Attachment Follows: prime number.txt
#include <stdio.h>
#include<conio.h>
void main()
{
int i, 8, n;
"#int$(%&n'nte# ho3 man) "#ime numbe#s )ou 3ant to "#int* %);
scan$(%+d%, ,n);
"#int$(%&n2%);
$o# (i=2; i<=n; i--)
$o# (8=2; 8<=i; 8--)
{
i$(i+8 == 0)
b#ea9;
else
{
"#int$(%&n+d%, i);
b#ea9;
5
5
getch();
5
Inline Attachment Follows: selection sort.txt
#include <stdio.h>
#include<conio.h>
void main()
{
int i, 8, min, tem",a[50], n;
"#int$(%&n'nte# si(e o$ an a##a)* %);
scan$(%+d%, ,n);
"#int$(%&n'nte# elements o$ an a##a)*&n%);
$o#(i=0; i<n; i--)
scan$(%+d%, ,a[i]);
$o# (i=0; i<n; i--)
{
min = i;
$o# (8=i-!; 8<n; 8--)
{
i$ (a[8] < a[min])
min = 8;
5
tem" = a[i];
a[i] = a[min];
a[min] = tem";
5
"#int$(%&n&n:$te# so#ting*&n%);
$o#(i=0; i<n; i--)
"#int$(%&n+d%, a[i]);
getch();
5

You might also like