Write a function which accepts an integer array of size n and prints every third value of the array.
#include <stdio.h>
#include <conio.h>
void print ( int arr[], int n )
{
int i;
for ( i = 2; i < n; i = i + 3 )
{
printf(" %d",arr[i]);
}
}
void main ( )
{
int arr[10], i;
clrscr ( );
for ( i = 0; i < 10; i++ )
{
printf("\n\t\t Enter a number..:"); scanf("%d",&arr[i]);
}
printf("\n\n\n\t Printing every 3rd integer of the array. ");
print(arr,10);
getch ( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void print ( int arr[], int n )
{
int i;
for ( i = 2; i < n; i = i + 3 )
{
printf(" %d",arr[i]);
}
}
void main ( )
{
int arr[10], i;
clrscr ( );
for ( i = 0; i < 10; i++ )
{
printf("\n\t\t Enter a number..:"); scanf("%d",&arr[i]);
}
printf("\n\n\n\t Printing every 3rd integer of the array. ");
print(arr,10);
getch ( );
}
Click here to contact us
No comments:
Post a Comment