Commit 9a1beebd by emonyi

Delete Homework1Ccode.c

parent 4b6dc9ba
Showing with 0 additions and 65 deletions
/**
* File: Homework1.c
* Author: ONYIA Emmanuel Chinedu
* created: 12.10.2018
* Last edit: 20.10.2018
*
* Desription:
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define LIMIT 15
int main(void)
{
//intialization of variables
float A=0;
int i=0;
int N=0;
float H=0;
float x;
double y;
//User enters values
//do-while statement ensuring user input A > 0; H > 0
do
{
printf("Enter the starting value A for arguments: ");
scanf("%f", &A);
if (A<=0)
{
printf("\nThe starting value must be Greater than 0\n\n");
}
}
while(A<=0);
do
{
printf("Enter the step value H for arguments: ");
scanf("%f", &H);
}
while(H<=0);
printf("\ns/n\tArguments (X)\tFunction(Y)\n");
x=A;
//for loop for number of prints limit 15
for(N=0; N<LIMIT ;N++)
{
//mathematical equation
x += i*(H);
y =(pow(sin(x+5), 2)+ cos(x))/(x + exp(x+3));
//output print statement
printf(" %d\t %0.2f\t\t %0.25f\n",N+1,x,y);
i++;
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment