A plot of y = 10*(1+sin(x)) from x=0.00 to 20.00
X Y
0.00 10.00 ##########
0.20 11.99 ############
0.40 13.89 ##############
0.60 15.65 ################
0.80 17.17 ##################
1.00 18.41 ###################
1.20 19.32 ####################
1.40 19.85 ####################
1.60 20.00 ####################
1.80 19.74 ####################
2.00 19.09 ####################
2.20 18.08 ###################
2.40 16.75 #################
2.60 15.16 ################
2.80 13.35 ##############
3.00 11.41 ############
3.20 9.42 ##########
3.40 7.44 ########
3.60 5.57 ######
3.80 3.88 ####
4.00 2.43 ###
4.20 1.28 ##
4.40 0.48 #
4.60 0.06 #
4.80 0.04 #
5.00 0.41 #
5.20 1.17 ##
5.40 2.27 ###
5.60 3.69 ####
5.80 5.35 ######
6.00 7.21 ########
6.20 9.17 ##########
6.40 11.17 ############
6.60 13.12 ##############
6.80 14.94 ###############
7.00 16.57 #################
7.20 17.94 ##################
7.40 18.99 ###################
7.60 19.68 ####################
7.80 19.99 ####################
8.00 19.89 ####################
8.20 19.41 ####################
8.40 18.55 ###################
8.60 17.34 ##################
8.80 15.85 ################
9.00 14.12 ###############
9.20 12.23 #############
9.40 10.25 ###########
9.60 8.26 #########
9.80 6.34 #######
10.00 4.56 #####
10.20 3.00 ####
10.40 1.72 ##
I don't know how to get the hash tages to print off, and this is the code I have so far:
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[])
{
float x,y;
printf("X\tY\n");
for(x=1;x<20;x++)
{
y =5*sin(1+(2*x));
printf("%.2f\t%.2f\t%c\n",x,y,'#'*y);
}
return 0;
}

New Topic/Question
Reply



MultiQuote




|