26.6.20

c program using arrays


USING ARRAYS:
void main()
{

    int a[100],n,i;

    printf("How many numbers do u want to enter:");
    scanf("%d",&n);

    printf("Enter numbers:");
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);

    printf("The entered numbers are\n");
    for(i=0;i<n;i++)
        printf("%d\n",a[i]);
}
OUTPUT:
How many numbers do u want to enter:4
Enter numbers:23
45
67
21
The entered numbers are
23
45
67
21

No comments:

Post a Comment

JAVA program pattern 2

import java.util.Scanner; public class pattern3 { public static void main(String args[]) { int i,j; Scanner sc=new Scanner(System.in); Syste...