1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
erastova [34]
2 years ago
15

Using the framework below add code to allow the loop to sum the odd numbers from 1 to 10 in the loop and print the sum out at th

e end. Recall that you can use modulo to determine if a number is odd or even. Your sum should make use of the loop counter or your own loop counting variable. So on the first loop if that integer number is an odd number, it should be added to the running total or sum variable. This should be done inside the for loop. Note that the loop counter starts at 1 instead of 0 in this case.
Your output should equal: 25 for this loop.


#include
< stdio.h >


int main(void)

{

int sum = 0;

for(int i = 1; i <=10; i++)

{

/* Your solution here */


}

printf("%d\n", sum);

return 0;

}//end main
Computers and Technology
1 answer:
Sergeu [11.5K]2 years ago
8 0

Answer:

Below

Explanation:

#include <stdio.h>

int main(void){

int sum = 0;

for(int i = 1; i <=10; i++){

   if (i % 2 != 0 ){

       sum += i;

   }

   }

printf("%d\n", sum);

return 0;

}//end main

You might be interested in
Let A be an array of n numbers. Recall that a pair of indices i, j is said to be under an inversion if A[i] &gt; A[j] and i &lt;
AysviL [449]

Answer:

Check the explanation

Explanation:

#include <stdio.h>

int inversions(int a[], int low, int high)

{

int mid= (high+low)/2;

if(low>=high)return 0 ;

else

{

int l= inversions(a,low,mid);

int r=inversions(a,mid+1,high);

int total= 0 ;

for(int i = low;i<=mid;i++)

{

for(int j=mid+1;j<=high;j++)

if(a[i]>a[j])total++;

}

return total+ l+r ;

}

}

int main() {

int a[]={5,4,3,2,1};

printf("%d",inversions(a,0,4));

  return 0;

}

Check the output in the below attached image.

5 0
3 years ago
Is there any app that understands fake photos<br><br><br>help me i need to know it​
Lapatulllka [165]

Answer:

Tineye Image Recognition. This app allows users to upload a picture or a URL to trace where else it appears online. ...

Reversee. This app stays true to its name. ...

Camfind. ...

Reverse Image Search.

7 0
3 years ago
Read 2 more answers
Which device is connected to a port on a switch in order to receive network traffic?
inysia [295]

Answer:

"Passive IDS" is the appropriate answer.

Explanation:

  • A framework that is designed mostly for monitoring and analyzing internet traffic operations and alerting a user or administrator about possible bugs, as well as disruptions, is known to be passive IDS.
  • This IDS cannot carry out certain preventive as well as remedial processes as well as operations by itself.
6 0
3 years ago
In implementing Security Life Cycle:__________
Dvinal [7]

Answer:

b) one needs to follow through all phases, assessment, design, deploy and manage security

Explanation:

The security life cycle is a process in which it involves the security artifacts for developing the software through a lifecycle. It contains a detailed plan that derives how to create an application form

At the time when the requirements and activity related to design is finished the next step is the software implementation. In this, the developers begins with the coding as per the requirements and designs discussed in the last step

Therefore according to the given options, the second option is correct

7 0
3 years ago
In every programming language, when you access data stored in an array, it is important to use a ____ containing a value that ac
Stells [14]
Subscript

Reference: Chapter 5 of 'An Object-Oriented Approach to Programming Logic and Design's by Joyce Farrell
4 0
3 years ago
Other questions:
  • ________ is a type of attack in which the attacker takes control of a session between two machines and masquerades as one of the
    5·1 answer
  • What system of representation is used for the threaded portions
    12·1 answer
  • What is one of the most effective security tools available for protecting users from external threats?
    15·1 answer
  • A telephone repair technician uses a meter to measure voltage on a phone line. This meter is an example of _____.
    10·2 answers
  • How long would it take a 8 bit computer to calculate π to the thousandth place?
    8·1 answer
  • ​ In the U.S., a work that was created in 2000 by an individual author who died in 2005 will be protected by copyright until ___
    5·2 answers
  • Is the Internet dangerous?
    10·2 answers
  • Someone wanna be in a meeting with me <br><br><br> Code: rrx-ofrw-ocj
    5·2 answers
  • Which is the best reason for why it is important to be careful about entering personal information online?
    10·2 answers
  • Select 3 true statements about Python class.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!