google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a program in c to store elements in an array and print it - 2nd puc computer science

Write a program in c to store elements in an array and print it

Write a program in c to store elements in an array and print it or write a c program to read and print elements of array

#include<stdio.h>

#include<conio.h>

void main()

{

int a[10],n,i;

clrscr();

printf("How many elements? ");

scanf("%d",&n);

printf("Enter the elements\n");

for(i=0;i<n;i++)

scanf("%d",&a[i]);

printf("The entered elements are\n");

for(i=0;i<n;i++)

printf("a[%d]=%d\n",i,a[i]);

getch();

}

Output:

How many elements? 5

Enter the elements                                                             

1                                                                              

2                                                                              

3                                                                              

4                                                                               

5                                                                              

The entered elements are                                                       

a[0]=1                                                                          

a[1]=2                                                                         

a[2]=3                                                                         

a[3]=4                                                                          

a[4]=5                                                                          
Write a program in c to store elements in an array and print it Write a program in c to store elements in an array and print it Reviewed by Vision Academy on December 09, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.