Velocity Reviews > plz send logic to write given program.

# plz send logic to write given program.

pitamber kumar
Guest
Posts: n/a

 03-02-2008
Write a program to find the number of and sum of all intergers greater
than 100 & less than 200 that are divisible by 7.

Sjouke Burry
Guest
Posts: n/a

 03-02-2008
pitamber kumar wrote:
> Write a program to find the number of and sum of all intergers greater
> than 100 & less than 200 that are divisible by 7.

We are not supposed to do your homework.
And dont think you will ever learn anything by cheating.

Johannes Bauer
Guest
Posts: n/a

 03-02-2008
pitamber kumar schrieb:
> Write a program to find the number of and sum of all intergers greater
> than 100 & less than 200 that are divisible by 7.

i=101; while [ \$i -lt 200 ]; do if [ \$((\$i%7)) -eq 0 ]; then echo
\$((\$i/7-14)): \$i; fi; i=\$((\$i+1)); done

You're welcome.

Kind regards,
Johannes

--
"PS: Ein Realname wäre nett. Ich selbst nutze nur keinen, weil mich die
meisten hier bereits mit Namen kennen." -- Markus Gronotte aka Makus /
Kosst Amojan / maqqusz / Mr. G / Ferdinand Simpson / Quartillia
Rosenberg in dse <45608268\$0\$5719\$(E-Mail Removed)-online.net>

Amandil
Guest
Posts: n/a

 03-02-2008
On Mar 2, 3:25 pm, pitamber kumar <(E-Mail Removed)> wrote:
> Write a program to find the number of and sum of all intergers greater
> than 100 & less than 200 that are divisible by 7.

Ok, I wrote it. Now you write one yourself, post it, and I'll see how
they compare.

In general, do not post homework questions. If you want to hide the
fact that it's a homework problem, show us what you have done, and

Hint: Use a loop to run through the numbers from 100 to 200. Check
each number if it's divisible by 7: If it is, add it to a running
total.

-- Marty

Keith Thompson
Guest
Posts: n/a

 03-02-2008
pitamber kumar <(E-Mail Removed)> writes:
> Write a program to find the number of and sum of all intergers greater
> than 100 & less than 200 that are divisible by 7.

Done.

(No, we will not do your homework for you.)

--
Keith Thompson (The_Other_Keith) <(E-Mail Removed)>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Kenny McCormack
Guest
Posts: n/a

 03-02-2008
In article <(E-Mail Removed)>,
Keith Thompson <(E-Mail Removed)> wrote:
>pitamber kumar <(E-Mail Removed)> writes:
>> Write a program to find the number of and sum of all intergers greater
>> than 100 & less than 200 that are divisible by 7.

>
>Done.
>
>
>(No, we will not do your homework for you.)

Actually, you just did. You just haven't published your results.

osmium
Guest
Posts: n/a

 03-02-2008
"pitamber kumar" writes:

> Write a program to find the number of and sum of all intergers greater
> than 100 & less than 200 that are divisible by 7.

Look at the modulo operator. Perversely, this is represented by '%'.

Ioannis Vranos
Guest
Posts: n/a

 03-02-2008
pitamber kumar wrote:
> Write a program to find the number of and sum of all intergers greater
> than 100 & less than 200 that are divisible by 7.

Why?

santosh
Guest
Posts: n/a

 03-02-2008
pitamber kumar wrote:

> Write a program to find the number of and sum of all intergers greater
> than 100 & less than 200 that are divisible by 7.

This is trivially easy. Show us your effort and you'll likely get good
help. But we don't do homework on demand.

Eric Sosman
Guest
Posts: n/a

 03-02-2008
pitamber kumar wrote:
> Write a program to find the number of and sum of all intergers greater
> than 100 & less than 200 that are divisible by 7.

Here you go. Invoke it exactly as described in the
"Usage" message, or it may misbehave.

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main(int l,char**s){static const short o[]={23,4,5,-2,-5,-11,14,
9,-5,1,-6,};int n,m;if(l!=2){fprintf(stderr,"Usage:\n\t%s \"Do your"
" own homework next time, vile cheater!\"\n",*s);return EXIT_FAILURE;
}for(m=n=puts(*++s)<0;m<(int)sizeof o;m+=sizeof(short)){n+=o[m/sizeof
(short)];putchar(toupper((unsigned char)(n[*s])));}puts("");return 0;}
--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)lid