# include <stdio.h>
# include <conio.h>
void main()
{
int a[20], i, n ;
clrscr() ;
printf("Enter the limit : ") ;
scanf("%d", &n) ;
printf("\nEnter the elements :\n\n") ;
for(i = 0 ; i < n ; i++)
scanf("%d", &a[i]) ;
printf("\nThe positive elements are :\n\n") ;
for(i = 0 ; i < n ; i++)
{
if(a[i] > 0)
printf("%d\t", a[i]) ;
}
getch() ;
}
RUN 1 :
~~~~~~~
Enter the limit : 5
Enter the elements :
10 -20 30 -40 -50
The positive elements are :
10 30
# include <conio.h>
void main()
{
int a[20], i, n ;
clrscr() ;
printf("Enter the limit : ") ;
scanf("%d", &n) ;
printf("\nEnter the elements :\n\n") ;
for(i = 0 ; i < n ; i++)
scanf("%d", &a[i]) ;
printf("\nThe positive elements are :\n\n") ;
for(i = 0 ; i < n ; i++)
{
if(a[i] > 0)
printf("%d\t", a[i]) ;
}
getch() ;
}
RUN 1 :
~~~~~~~
Enter the limit : 5
Enter the elements :
10 -20 30 -40 -50
The positive elements are :
10 30
No comments:
Post a Comment