Question

IN C, write a program that declares an array of 100 integers and initializes it to...

IN C, write a program that declares an array of 100 integers and initializes it to the values (100, 99, …, 2, 1)

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

#include <stdio.h>

int main(void) {

// declaring variables

int a[100], i, value = 100;

// looping from 0-99

// indices start from 0

for(i=0; i<100; i++)

{

a[i] = value;

value--; // decrementing by 1

}

// printing array

for(i=0; i<100; i++)

printf("%d ", a[i]);

return 0;

}

// Hit the thumbs up if you are fine with the answer. Happy Learning!

Add a comment
Know the answer?
Add Answer to:
IN C, write a program that declares an array of 100 integers and initializes it to...
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
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