C Program to arrange the number in decending order
dimension a(100)
write(*,*)'Enter the no. of terms:'
read(*,*)n
write(*,*)'Enter the numbers:'
do i=1,n
read(*,*)a(i)
end do
do i=1,n-1
do j=i+1,n
if (a(i).lt.a(j))then
temp=a(i)
a(i)=a(j)
a(j)=temp
end if
end do
end do
write(*,*)'The numbers in decending order is:'
do i=1,n
write(*,*)a(i)
end do
end
dimension a(100)
write(*,*)'Enter the no. of terms:'
read(*,*)n
write(*,*)'Enter the numbers:'
do i=1,n
read(*,*)a(i)
end do
do i=1,n-1
do j=i+1,n
if (a(i).lt.a(j))then
temp=a(i)
a(i)=a(j)
a(j)=temp
end if
end do
end do
write(*,*)'The numbers in decending order is:'
do i=1,n
write(*,*)a(i)
end do
end
Comments
Post a Comment