Multiple number to array Data structure by R4R Team

Array:

Array is the collection of different values having same data type.
-We have a integer Array that having all integer values.
-Character array is known as String.

Example-
Array is {1,2,3,4,5}
number is 2
Array become {2,4,6,8,10}

program-

#include < stdio.h>
int main()
{
int a[100],n,i,num;
printf("Number of elements in array ?\n");
scanf("%d",&n);
printf("Enter %d number in array\n",n);
//Input in array
for(i=0;i< n;i++){
scanf("%d",&a[i]);
}
printf("Enter number to multiple\n");
scanf("%d",&num);
//Now multiple
for(i=0;i< n;i++)
{
a[i]=a[i]*num;
}
//Traverse
printf("Array is\n");
for(i=0;i< 5;i++)
printf("%d,",a[i]);
}


output-

Number of elements in array ?
5
Enter 5 number in array
1 2 3 4 5
Enter number to multiple
2
Array is
2,4,6,8,10,




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!