pastebin
Add a new paste
View all pastes
Change language
Dutch
English
French
Russian
menu
URL Shortener
Multiple URL shortener
browser info
Whois IP and domain lookup
Capture a Website screenshot
Disqus Chatroom
Registration
pastebin
Paste Search Dynamic
Recent pastes
Adambrooks
22 minutes ago
cnt
6 hours ago
warning infinitely in
6 hours ago
BHPSOGWO
6 hours ago
Arrays associate
6 hours ago
Schedule
6 hours ago
Arrays associate error
6 hours ago
test
6 hours ago
ArrayList
6 hours ago
mainloop
6 hours ago
Largest Smallest element
#include <stdio.h>
int
main
(
)
{
int
arr
[
100
]
, n, i, small, large;
printf
(
"Enter the number of elements you want to insert : "
)
;
scanf
(
"%d"
, &n
)
;
for
(
i =
0
; i < n; i++
)
{
printf
(
"Enter element %d : "
, i +
1
)
;
scanf
(
"%d"
, &arr
[
i
]
)
;
}
small = arr
[
0
]
;
large = arr
[
0
]
;
for
(
i =
1
; i < n; i++
)
{
if
(
arr
[
i
]
< small
)
{
small = arr
[
i
]
;
}
if
(
arr
[
i
]
> large
)
{
large = arr
[
i
]
;
}
}
printf
(
"nLargest element is : %d"
, large
)
;
printf
(
"nSmallest element is : %d"
, small
)
;
return
0
;
}
Parsed in 0.011 seconds