Commit 6eaf413e by emonyi

Upload New File

parent d9eca1f4
Showing with 66 additions and 0 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
double t;
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(t+5), 2)+ cos(t))/(x + exp(t+3));
//output print statement
printf(" %d\t %0.2f\t\t %0.4f\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