Java Stream API — Even Numbers (Full Screen) Java Stream API — Get Even Numbers Example 1 — Filter even numbers from a list Creates a list, uses Stream to filter evens, and prints them. Copy import java.util.*; import java.util.stream.*; public class EvenNumbersStream { public static void main(String[] args) { // Create a list of numbers List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); // Use Stream API to filter even numbers List<Integer> evenNumbers = numbers.stream() .filter(n -> n % 2 == 0) .collect(Collectors.toList()); // Print the even numbers System.out.println( "Even numbers: " + evenNumbers); } } Example 2 — Use IntStream.rangeClosed ...
In this C-program we will Scan and Print 5 numbers using Array. This is a simple Array program. The numbers will be taken from the user.
input:
5 numbers.(i.e : 5,6,9,56,548)output:
The given numbers by user will be printed on the screen.
CODE---->
#include<stdio.h>
#include<stdlib.h>
//This header file contains the system() function.
main()
{
int arr[5],i;
printf(" Enter Five numbers : ");
for(i=0;i<5;i++)
{
scanf("%d",&arr[i]);
}
printf("\n You have Entered these following numbers : \n");
for(i=0;i<5;i++)
{
printf(" %d\n", arr[i]);
}
system("pause");
//this function is called for pause the screen.
}
RESULT:
Such Nice a Working.Thanks For Sharing it.
ReplyDelete4k Video Downloader Crack
By Click Downloader Crack