zzulioj 1047: logarithmic table

Title description
Input two positive integers m and n, and output the natural logarithm of each integer between m and n.
Input
Input consists of two integers m and n (m<=n), separated by a space.

Output
Each line outputs an integer and its logarithm. The integer occupies 4 columns, the logarithm occupies 8 columns, right-justified, and the logarithm retains 4 decimal places.
Sample input Copy
2 4
Sample output Copy
2 0.6931
3 1.0986
4 1.3863
Tip
...

#include<stdio.h>
#include<math.h>
int main()
{
    
    
	int m,n;
	double a;
	scanf("%d%d",&m,&n);
	for( ;m<=n;m++)
	{
    
    
		a=log(m);
		printf("%4d%8.4lf\n",m,a);
	}
	return 0;
 } 

Guess you like

Origin blog.csdn.net/m0_53024529/article/details/112981987