Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(1) Prepare an HTML file, prob3.html , with the following content: This program computes 1 + 2 + 3 + .... + n where n

(1) Prepare an HTML file, prob3.html, with the following content:

 This program computes 1 + 2 + 3 + .... + n where n is entered from the browser. 

Enter n:

where your_account_name needs to be replaced by your actual login name. Verify boxes and other tags.(2) Write a CGI program which communicates with the above program to return the desired result.(3) Execute

http://omega.uta.edu/~youraccount/prob3.html 

Note: You have to place this *.html file in the public_html directory, not in the cgi-bin directory.Hint The following html file and c (cgi) file compute the sum of two numbers entered from the browser:

 This program computes the sum of two numbers. 

Enter m:

Enter n:

#include  #include  int main() { float m,n; /* The variable input takes parameters passed by HTML */ char *input = getenv("QUERY_STRING"); /* We now separate m and n from one long string of "input" */ sscanf(input, "number1=%f&number2=%f", &m, &n); /* CGI script must spit the following string no matter what ! */ printf("Content-type: text/html "); /* Any printf command hereafter is output to the web browser. */ printf("The sum is = %f" ,m+n); return 0; } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions