如何在C程序文件中的此方程式中使用while循环 [英] How can I use while loop in this equations in C program file

查看:72
本文介绍了如何在C程序文件中的此方程式中使用while循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

What is the code for M=log (13*E/4*C) + log (23*E/14*C) +log (33*E/24*C); when E is odd numbers and C is negative numbers in c programming? Note: I must use do while loop for my answer 




also What is the code for k=3.14+ x * tanh (beta); when x is equal to 20 and beta is divisible by 8 in c programming?



< https://serving.photos.photobox.com/5524842271696cec942256c8b551bdfc2532f223f90844dd88196a152234eddb6c99fb09.jpg [ ^ ]



我尝试过:




<https://serving.photos.photobox.com/5524842271696cec942256c8b551bdfc2532f223f90844dd88196a152234eddb6c99fb09.jpg[^]

What I have tried:

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <conio.h>



int main(void)
{
    int x;

double k , K;

int E,C, beta=90;
int M;

    char choice;


puts("--------------------------");
  puts("****List of Choices*****");
  puts("--------------------------");
  puts("- Select F or f");
  puts("- Select G or g");
  puts("- Select J");
  puts("--------------------------");
  printf("Your choice: ");
  scanf("%c",&choice);
  puts("--------------------------");

  switch(choice)
  {
    case 'F':
while ( x<=20){
    if (beta%8==0){

    }
    x++;

       K=3.14+ x * tanh (beta);
        printf( "The value of K is:" "%f\n",K);
}
      break;



      case 'f':
while ( x<=20){
    if (beta%8==0){
    }
    x++;

       k=3.14+ x * tanh (beta);
        printf( "The value of K is:" "%f\n",k);
}
      break;


    case 'G':
 // printf( "Enter value of E is:");
  //scanf( "%d",&E);
  //  printf( "Enter value of C is:");
  //scanf( "%d",&C);

    while(E % 2 == 0 && C <0){
M=log(13*E/4*C) + log(23*E/14*C) +log(33*E/24*C);
    }
       printf("The value of M :""%d",M);

      break;



      case 'g':

printf( "Enter value of E is:");
  scanf( "%d",&E);
  printf( "Enter value of C is:");
 scanf( "%d",&C);
while (x=1){
      if(E % 2 == 0 && C <0){
M=log(13*E/4*C) + log(23*E/14*C) +log(33*E/24*C);
    }

    x++;}
       printf("The value of M :""%d",M);
      break;





    case 'J':
      puts("Welcome to Engineering Department ");
  
      break;
    default:
      printf("Error Message:You entered wrong choice");
      break;
      }




getch();
return 0;
}

推荐答案

我们不做你的功课:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但是我们不打算为你做这一切!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


你需要从一些教程中学习语言,比如学习C



您将学习如何创建可以在其他功能中调用的函数。但是编译器在使用之前必须知道它们。所以你可以这样编码:

You need to learn the language from some tutorial like Learn C.

In that you will learn that you can create functions, which you can call in other function. But the compiler must know them before they are used. So you can code like that:
while( item < 10 ) 
{
  int res = myFunction();
}


这篇关于如何在C程序文件中的此方程式中使用while循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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