Array
This commit is contained in:
23
Array.c
Normal file
23
Array.c
Normal file
@@ -0,0 +1,23 @@
|
||||
// WAP to print out an array of dynamic values.
|
||||
|
||||
void main() {
|
||||
int r,n,i,a[10];
|
||||
|
||||
// To set range of array:
|
||||
printf("\n Enter the range of array: \n");
|
||||
scanf("%d", &n);
|
||||
|
||||
// To get values of array:
|
||||
printf("\n Enter the elements of the array: \n");
|
||||
r = 0;
|
||||
for (i=0 ; i<=n; i++) {
|
||||
scanf("%d", &a[i]);
|
||||
}
|
||||
|
||||
// To print the elements of the array:
|
||||
printf("\n The elements of the array are: \n");
|
||||
for (i=0 ; i<=n; i++) {
|
||||
r++;
|
||||
printf("\n a[%d] = %d \n", r, a[i]);
|
||||
}
|
||||
}
|
||||
@@ -23,4 +23,5 @@
|
||||
|21 | Triangle.c | Triangle.exe | WAP to check whether a triangle can be formed by the given value for the angles |
|
||||
|22 | Calculator.c | Calculator.exe | Write a menu driven program for calculator |
|
||||
|23 | MultiplicationTable.c | MultiplicationTable.exe | WAP to print the multiplication table for a given number |
|
||||
|24 | Divisible.c | Divisible.exe | WAP to find an addition of numbers which are >30, <100 & divisible by 7 |
|
||||
|24 | Divisible.c | Divisible.exe | WAP to find an addition of numbers which are >30, <100 & divisible by 7 |
|
||||
|25 | Array.c | Array.exe | WAP to print out an array of dynamic values |
|
||||
Reference in New Issue
Block a user