0% found this document useful (0 votes)
25 views6 pages

Computer Practical

This program finds the smallest number in an array. It takes user input for the number of elements in the array, then inputs the elements. It initializes the smallest variable to the first element of the array. It iterates through the array and compares each element to the smallest variable, updating smallest and its position if a smaller element is found. Finally, it outputs the smallest number and its position in the array. The program is 3 sentences or less as requested.

Uploaded by

Sadik Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views6 pages

Computer Practical

This program finds the smallest number in an array. It takes user input for the number of elements in the array, then inputs the elements. It initializes the smallest variable to the first element of the array. It iterates through the array and compares each element to the smallest variable, updating smallest and its position if a smaller element is found. Finally, it outputs the smallest number and its position in the array. The program is 3 sentences or less as requested.

Uploaded by

Sadik Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Te

Date:
Program no: 4 5t

Aim of project: alamat tAMsxiOAA


tohuias
Programmingcode:
ucludi iostbeamoh

Void mau C )

CC100], n ,i, i k , Jamp

Cout < the

Cous k< " Enion lemw the

cu >a

(K 1 k =n- 1 k ++ )

temp a CK,
4

Teachers sign:
Program no: 4 Date:

Aim of project:

Programming code:
I:tJ : a

a Cit 1]
a
Iamp

lout
Aroay

Teachers sign:
Date:
Program no:

Aim of project:
Programming code:

Qutpu
Bui 25
alanu u the JUy
2

Sonting

/ 4 / 2 4

Teachers sign:
vojd mainl)

iat as1T4],4[41[41,1, j se[1111;


fesen);

Cuut <"Eni eamna 2nd mal n"

'(pn (j=oj <íijtr)

cout <1n";
)

fon(izo; ik4; it)

fon(i=o; <4,i++)

3
3 n"!
coutk" Th ad dilona/ malrix

cout« e[iJ]K\E

3
Write a program to find the smallest number of an array ?
SoLUTION
#indudeciostream.h>
#include<stdio.h>
# include<conio.h>
void main( )

int small, a(100], I, n, s, pos i


clrscr( ) :
cout << "How many elements in an array : :
cin >> n;
cout k< "Enter the elements :" << endl ;
for(i = 0; i<en-1; +)
cin >> a ):
small = a[0]:.
pos = 0 :
for(i= i;i«n-1; +)
if(small > a i )

small = a[o] :
pos = i;

cout << endl << "The smallest of the entted no is << small ;
cout << endl << "The position of the smallest no is << pos+1;
getch( ) :

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy