#include
void main ()
{
int i, total;
int arr[10];
int *a;
a = arr;
for ( i = 0; i < 10; i++ )
{
printf ( " Enter the number %d: ", i+1 );
scanf ( " %d ", &arr[i] );
}
for ( i = 0; i < 10; i++ )
{
printf ( " %d--- ", *a );
total = total + *a;
a = a + 1;
}
printf ("\nTotal = %d \n",total);
}
OUTPUT:
Enter the number 1: 1
Enter the number 2: 2
Enter the number 3: 3
Enter the number 4: 4
Enter the number 5: 5
Enter the number 6: 6
Enter the number 7: 7
Enter the number 8: 8
Enter the number 9: 9
Enter the number 10: 10
1---2---3---4---5---6---7---8---9---10---
Total = 55
No comments:
Post a Comment