I make a code,,,,,, but may be here some problem.......

include <stdio.h>

define n_num 11

int main() { int arr[11]; int i, total; total=0; for (i=2; i<2048;) { arr[i]=i*2; total=total+arr[i]; } printf("The average=%f\n", (float)total/n_num); return 0; }

asked 07 Dec '16, 03:12

unipro4urs's gravatar image

unipro4urs
91

2+4+8+16+...........+2048 এই ভেলু গুল কি আগে থেকেই কোন অ্যারে তে জমা করা আছে ?

(07 Dec '16, 13:27) menon

আমি ধরে নিলাম 2+4+8+16+...........+2048 এই ভালু গুল int dara[]; নামের অ্যারে তে জমা করা আছে । এখন আপনি যদি পয়েন্টের বাবহার করে এই ডাটা গুলির avg বের করতে চান তবে নিচের মত করে কোড লিখতে পারেন

কোড :

    for(int i = 0; i < size; i++) {
        total = total +  *(data + i); // access the value by *(data + i) and sum it to total
    }
    printf("avg: %lf\n", total / size);

ধন্যবাদ

permanent link

answered 07 Dec '16, 13:38

menon's gravatar image

menon
4.7k334

edited 16 Dec '16, 04:49

You comment in answer section. Please comment in comment section and if you got your answer than AC it :) @unipro4urs

(11 Dec '16, 16:01) menon

Thank you very much

permanent link

answered 11 Dec '16, 15:40

unipro4urs's gravatar image

unipro4urs
91

can anyone write the whole program.............?

permanent link

answered 20 Dec '16, 01:11

unipro4urs's gravatar image

unipro4urs
91

include<stdio.h>

include<stdib.h>

include<time.h>

define limit 10000000/size of integers array/

int main() { unsigned long long int i,j; int primes; begin = clock(); primes = malloc(sizeof(int)limit); for (i=2;i<limit;i++){ primes[i]=1;} for(i=2;i<limit;i++){ if(primes[i])} for (j=i;i*j<limit;j++){ end = clock();} printf("%f\n",(double)(end-begin)/CLOCKS_PER_SEC);

for (i=2;i<limit;i++){
    if (primes[i])
}
    printf("%dth prime=%dn", z++,i);
return 0;

} please help to solve the problem

permanent link

answered 20 Dec '16, 02:11

unipro4urs's gravatar image

unipro4urs
91

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×56
×54
×13
×1

question asked: 07 Dec '16, 03:12

question was seen: 762 times

last updated: 20 Dec '16, 02:11