Hiz well i m new in here n i m goin to have exam after 3 days :S i got stuckd in a question
Q) Write a program to print the product of even numbers.....

plz i m new with c langauge :S n i m having final exam jst after 3 DAys :S
thnx

Recommended Answers

What code have you written so far?

Jump to Post

This will show the even integers between 2 and limit, then it is up to you to show the product:

#include <stdio.h>

int main()
{
  int x;
  int limit = 30;
  
  for(x = 2; x <= limit; x=x+2)
  {
    printf("%d\n", x);
  }
  
  getchar();  // wait for enter …
Jump to Post

All 7 Replies

What code have you written so far?

Actually i havent started yet......i saw the question in exercise n i didnt found any example in my book....so thats y i asked it here

This will show the even integers between 2 and limit, then it is up to you to show the product:

#include <stdio.h>

int main()
{
  int x;
  int limit = 30;
  
  for(x = 2; x <= limit; x=x+2)
  {
    printf("%d\n", x);
  }
  
  getchar();  // wait for enter
  return 0;
}

Thankyou :)

but tis showing 143254346436 :S lolz ,..........i mean some numbers.......:S

Post your code.

well after this u only have to print the product so create a new variable long prefferably to store x*x and print tht outside the loop

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.