All pastes #420786 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-02 11:54 UTC
rendered paste body
// k3.cpp : Defines the entry point for the console application.
// funckja do obliczania sumy k (nad) E (nad) i=1 1/i. k podaje user

#include "stdafx.h"


float suma(float k) {
	float m, s;
		for(m = 1, s = 0; m <= k; ++m) {
		s = s + (1 / m);
		}
	return s;
}

int _tmain(int argc, _TCHAR* argv[])
{
	float l;
	printf("Podaj liczbe:\n");
	scanf("%f", &l);
	printf("Suma wynosi %f\n", suma(l));
}