Skip to content

Instantly share code, notes, and snippets.

@naemazam
Created March 7, 2022 09:03
Show Gist options
  • Save naemazam/9c7a760af016720598bc563d921390e6 to your computer and use it in GitHub Desktop.
Save naemazam/9c7a760af016720598bc563d921390e6 to your computer and use it in GitHub Desktop.
declare an array to save 10 integers output all the negative numbers
/* C Program to Print Negative Numbers in an Array */
#include<stdio.h>
int main()
{
int Size, i, a[10];
Size = 10;
printf("\n Please Enter the Array Elements : ");
for(i = 0; i < Size; i++)
{
scanf("%d", &a[i]);
}
printf("\n List of Negative Numbers in this Array : ");
for(i = 0; i < Size; i ++)
{
if(a[i] < 0)
{
printf("%d ", a[i]);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment