Filled Under: ,

C program to find the value of y using the equation


 C program to find the value of y using the equation


 C program to find the value of y using the equation


 In this program, I have discussed about the  C program to find the value of y using the equation.


#include<stdio.h>
void main()
{
      float n,x,y;
      printf("Enter the value of n");
      scanf("%f",&n);
      printf("Enter the value of x");
      scanf("%f",&x);
      if(n==1)
         {y=1+(x*x);
         printf("Y=%f",y);}
      else if (n==2)
         {y=1+(x/n);
         printf("Y=%f",y);}
      else if(n==3)
         {y=1+(2*x);
         printf("Y=%f",y);}
      if(n<1||n>3)
        { y=1+(n*x);
         printf("Y=%f",y);}
}


Just copy and paste the program in your desired compiler (Dev C++ is more preferable) and run it.

Enjoy programming in C.

0 comments:

Post a Comment

 

Copyright 2020 Programming in C All Right Reserved