![looloo273](/avatars/31191.jpg)
looloo273
04.09.2021 •
Computers and Technology
I have the ability to store 12 bits. What is the highest decimal number I can represent?
Solved
Show answers
More tips
- H Health and Medicine What vaccines do children need?...
- H Health and Medicine Reasons for the Appearance of Warts: Everything You Need to Know...
- G Goods and services What Are the Most Popular Services?...
- O Other What is the oldest joke ever told?...
- L Legal consultation How to Properly Inherit: Tips and Recommendations...
- C Computers and Internet Boost your processor performance with these easy tips...
- S Sport How does Bodyflex work: what is it and how does it work?...
- H Health and Medicine How to Whiten Teeth and Get the Perfect Smile...
- S Style and Beauty How to Properly Apply Eye Makeup: Tips from a Professional Makeup Artist...
- A Auto and Moto How Can Parking Sensors Help Drivers?...
Answers on questions: Computers and Technology
- C Computers and Technology A desktop computeris the case that houses the main components is the case that houses the main components of the computer and where peripheral devices connect....
- C Chemistry The Florissant Fossil Beds in Colorado are home to several massive redwood stumps that were subjected to a special kind of fossilization millions of years ago What service could these...
- C Chemistry How are air resistance and friction similar? A. They are both noncontact forces. B. They are both types of nuclear forces. C. They both slow things down. D. They both work using gravity....
Ответ:
#include <stdio.h>
int main()
{
int A[10];
int sum = 0;
printf("Enter array elements\n");
for (int i = 0; i < 10 ; i++)
scanf("%d", &A[i]);
for (int i = 0; i < 10 ; i++) {
if (i % 2 ==1)
sum += A[i];
}
printf("Sum of odd indexed elements: %d \n", sum);
printf("Array in reverse order: ");
for (int i = 9; i >= 0; i--)
printf("%d ", A[i]);
return 0;
}
Explanation:
Declare the array and sum variable
Ask user for the array elements and put them in the array using for loop
Calculate the sum of the numbers that are at odd index, check if the index is odd using modulo operator
Print the array in reverse order using for loop, start the index from 9 and go until 0, so that it will print from back