-->

program to store any 'n' elements and display those which are >15.

using turbo C++
-----------------------------------------------------------------------
// program to store any 'n' elements and display those which are >15.
#include <stdio.h>
#include<conio.h>
void main()
{
    int a[100],n,i;
    printf("enter total number\n");
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        printf("enter number for location=%d\n",i);
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        if(a[i]>15)
                {
                   printf("%d\n",a[i]);
                 }
    }
    getch();
}
-------------------------------------------------------------------------------------------------------------------
using online compiler/devC++/codeblocks with return concept
---------------------------------------------------------------------------------------------------------------------
// program to store any 'n' elements and display those which are >15.
#include <stdio.h>

int main()
{
    int a[100],n,i;
    printf("enter total number\n");
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        printf("enter number for location=%d\n",i);
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
          if(a[i]>15)
                {
                   printf("%d\n",a[i]);
                 }
    }
    return 0;
}

No comments:

Post a Comment