[ create a new paste ] login | about

Link: http://codepad.org/xl0Aiq5L    [ raw code | output | fork ]

C++, pasted on Dec 2:
#include <stdio.h>
#include <stdlib.h>

#define N 20

int main(int argc, char* argv[])
{
	int A[N] = { 0 };

	for (int z = 0; z < N; z++)
	{
		A[z] = rand() % 9 + 1;
		printf("%d ",A[z]);
	}

	printf("\n");

	int mul = 1, i = 1; 
	while (i < N) { mul*=A[i]; i+=2; }

	A[N-1] = mul;

	for (int z1 = 0; z1 < N; z1++)
		printf("%d ",A[z1]);

	printf("\n");

	return 0;
}


Output:
1
2
2 8 1 8 6 8 2 4 7 2 6 5 6 8 6 5 7 1 8 2 
2 8 1 8 6 8 2 4 7 2 6 5 6 8 6 5 7 1 8 1638400 


Create a new paste based on this one


Comments: