C如何得到2 ^ x = 3000的x? /* 2次幂x等于3000 */ [英] C How to get x of 2^x=3000? /* 2 power x equal to 3000 */

查看:135
本文介绍了C如何得到2 ^ x = 3000的x? /* 2次幂x等于3000 */的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要您的帮助以C语言编写,并使用GCC进行编译.

2 ^ x = i

int我将从用户命令行获取;
主要功能是获取x;
x将输出为整数;
如果x输出为float,即3.2,则函数在."后面输出3个下降值. 如何用C程序编写?
感谢任何类型的编程类型和您的帮助.
我是初学者.

I need your help writing in C, compile with GCC.

2^x=i

int i will get from user command line;
the main function is to get x;
x will output as integer;
if x output as float,i.e, 3.2, the function outputs 3 dropping value behind " . ";
how to write in C Program?
I appreciate any kind of programming type and your help.
I''m beginner.

推荐答案

该事物称为二进制对数". C ++中没有log2(number)函数吗?如果不是,则采用其他对数和一些数学运算:log(number)/log(2).
The thing is called "binary logarithm". Isn''t there a log2(number) function in C++? If not, then take some other logarithm, and some math: log(number)/log(2).


这篇关于C如何得到2 ^ x = 3000的x? /* 2次幂x等于3000 */的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆