All pastes #454069 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-23 11:50 UTC
rendered paste body
// tablica_lp.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdlib.h"


int _tmain(int argc, _TCHAR* argv[])
{
	int tablica[5][5];
	int w, k, l, s;
	float sr;

	for(w = 0, l = 1; w < 5; ++w) {
		for(k = 0; k < 5; ++k, ++l) {
		tablica[w][k] = l;
		}
	}

	for(w = 0, s = 0, l = 0; w < 5; ++w) {
		for(k = 0; k < w; ++k) {
		s += tablica[w][k];
		++l;
		}
	}

	sr = s / l;
	printf("Srednia liczb spod przekatnej tablicy wynosi: %f\n", sr);
	system("pause");
}