Write a program to print all negative elements in an array.
- #include <stdio.h>
- int main()
- {
- int arr[100];
- int i, num;
- printf("Enter size of the array : ");
- scanf("%d", &num);
- printf("Enter elements in array : ");
- for(i=0; i<num; i++) {
- scanf("%d", &arr[i]);
- }
- printf("All negative elements in array are : ");
- for(i=0; i<num; i++) {
- if(arr[i] < 0) {
- printf("%5d", arr[i]);
- }
- }
- return 0;
- }
একটি মন্তব্য পোস্ট করুন