Question

Using C language to write a program. First, to write Hello Wrold Second. Use a while...

Using C language to write a program.

First, to write Hello Wrold

Second. Use a while loop to calculate the sum of positive even integers below 200 and print the result to the standard output. This is very similar to the sum example we have studied. Think about how much you should increase the loop control variable to get to the next even number. Your program should output the following text.

output should be :

Hello, World!

9900

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <stdio.h>

int main()
{
   //First, to write Hello Wrold
printf("Hello, World!");
int i=0;
int sum = 0;
//a while loop to calculate the sum of positive even integers below 200
   while(i<200){
       if(i%2==0)
           sum += i;
       i++;
   }
   //print the result to the standard output
   printf("\n%d",sum);
return 0;
}

#include <stdio.h> C:\Program Fil: int main() Hello, World! 9900 Process exited normally. Press any key to continue . . . pri

Add a comment
Know the answer?
Add Answer to:
Using C language to write a program. First, to write Hello Wrold Second. Use a while...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use a java program that does the following: . (10 points) Write a program as follows...

    Use a java program that does the following: . (10 points) Write a program as follows a. Prompt the user to input two positive integers: nl and n2 (nl should be less than n2) b. If the user enters the negative number(s), convert it/them to positive number(s) c. If nl is greater than n2, swap them. d. Use a while loop to output all the even numbers between nl and n2 e. Use a while loop to output the sum...

  • ASSEMBLY LANGUAGE Write a program using author's routine, WriteString, to print "Hello World". This routine will...

    ASSEMBLY LANGUAGE Write a program using author's routine, WriteString, to print "Hello World". This routine will output to the screen any character data pointed to by the EDX register. It will continue to print until it runs into the null character (zero). We need only to move the address into the EDX register and calll his routine. Lookup in the ASCII code chart the value reqresented by CR and LF. In the program I will define these values using the...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list : You are given a sequence of n positive integers a1,a2,…,an, where n is even. Swap adjacent elements in the given sequence and print the resulting sequence: a2,a1,a4,a3,a6,a5,… Input The first line contains a positive even integer n (2≤n≤1000) — the length of the sequence. The second line contains n space-separated integers a1,a2,…,an (1≤ai≤1000) — the elements of the sequence. Output Print n...

  • Objectives: Use the while loop in a program Use the do-while loop in a second program...

    Objectives: Use the while loop in a program Use the do-while loop in a second program Use the for loop in a third program Instructions: Part A. Code a for loop to print the Celsius temperatures for Fahrenheit temperatures 25 to 125. C = 5/9(F – 32).Output should be in a table format: Fahrenheit Celsius 25 ? . . . . . . . . Turn in the source and the output from Part A. Part B. Code a while...

  • in c++ language 1.Re-write the following for loop statement by using a while loop statement: int...

    in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){                 sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() {    int score, highest;             //missing portion of the program             return 0;    } 1(c). Find the missing portion of the following code, so the...

  • ssembly Language Programming with x86, IRVINe MASM 1. Write a program to add 7 12 times...

    ssembly Language Programming with x86, IRVINe MASM 1. Write a program to add 7 12 times and print out the result ------------------------------------------------------------------------------- Write a program to print and add 10 20 30 40 50   ; you can use a loop The output should be “The sum of 10 20 30 40 50 ”

  • d printAllIntegers () Write a C++ program that defines and tests a function largest(....) that takes...

    d printAllIntegers () Write a C++ program that defines and tests a function largest(....) that takes as parame- ters any three integers and returns the largest of the three integers. Your output should have the same format and should work for any integers a user enters Desired output: Enter three integers: 6 15 8 The largest integer is: 15 7.3 Recursive Functions Write a program that uses a function sum(int) that takes as an argument a positive integer n and...

  • Solve using C language The mathematician Euler proved that: tan-(x) = x -. Write a C...

    Solve using C language The mathematician Euler proved that: tan-(x) = x -. Write a C program to do the following: -Ask user to enter the value of (x) radians, -0.5<=x<=0.5. -Calculate and print the actual value atan (x)in degrees. - Use loops to calculate and print the series sum in degrees. -loop should stop when absolute difference between actual and series sum become <=10-3. -Print out number of iterations needed to get the result. - The program should run...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other in the sequence. Input The first line contains an integer n...

  • Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program...

    Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program that contains the following functions: 1. A function to read integer values into a one-dimensional array of size N. 2. A function to sort a one-dimensional array of size N of integers in descending order. 3. A function to find and output the average of the values in a one dimensional array of size N of integers. 4. A function to output a one-dimensional...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT