Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
Why this programm doesn't work?
+2
votes
asked
Nov 13, 2019
by
Anton
#include <stdio.h>
#include <math.h>
int
main ()
{
int n, i, c,s, b,a,r=0;
scanf ("%d %d", &a, &n);
s=s+a;
for (i=0; i<=n; i++)
{
b=10*r;
c=a*b;
s=s+c;
r++ ;
}
printf ("%d", s);
return 0;
}
c
-for
loops
needhelp
-help-plz-
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
14 Answers
0
votes
answered
Jan 8, 2020
by
Suryateja Koka
(
140
points)
it is properly working
give a printf to help others to know entering values
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
0
votes
answered
Jan 14, 2020
by
Chandra Sagar
(
260
points)
yes it is working right once go through again
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
0
votes
answered
Jan 24, 2020
by
anonymous
it's running perfectly. All you need is to declare s=0.
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
0
votes
answered
Jan 25, 2020
by
anonymous
because you should initiate the value of s=0 while declaring variable so variable s can not store the garbage value.
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
Page:
« prev
1
2
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...