🎓 Academic FREE Çℎḙḡḡ, SCRIBD, STUDOC, AND BARTLEBY THREAD UNLOCK (CLOSED)

Status
Not open for further replies.
sa second link mo po baka my classmate ka dito naka unlock kasi ako ng ganyan hehehe
 

Attachments

1619779250276.webp

pasensya poooo talagaaaaaa
 
Pa unlock po lods salamat :))
https://www.Çℎḙḡḡ.com/homework-help...62?trackid=27a2e8e6413f&strackid=f5ddefc34545
 
https://www.Çℎḙḡḡ.com/homework-help...eginning-n-ending-m-n-m-inputted-us-q62955551

pa unlock po. Thank you :)
 
#include <stdio.h>

int main()
{
int n,m ,sm=0,w;
printf("Enter Beginning Number:");
scanf("%d",&n);
printf("Enter Ending Number:");
scanf("%d",&m);
w=n;
//checking weather the n is equal to m
if(n==m)
{
//printing required output
printf("Error in input.Beginning and Ending numbers are the same.");

}
//checking weather n is greater than m
else if (n>m)
{
//printing required output
printf("Error in input. Beginning number is larger than the Ending number");
}
//if none of condition is true
else
{
//looping through all element fromn to m
while(w<=m)
{
//checking weather the element is odd
if (w%2!=0)
{
//if odd then add it to sm
sm=sm+w;
}
//increment w by 1
w++;
}
//printing result
printf("The sum of all odd numbers from %d to %d is %d",n,m,sm);

}

return 0;
}
 
Thank you! Wala po kasing binigay na example si Mam. I have the same answer po but different lang po ang structure and statement kaya po nag-eerror ang program.
 
Status
Not open for further replies.

About this Thread

  • 104
    Replies
  • 4K
    Views
  • 25
    Participants
Last reply from:
Emorej14324

New Topics

Online now

Members online
1,196
Guests online
2,513
Total visitors
3,709

Forum statistics

Threads
2,283,259
Posts
29,014,293
Members
1,222,344
Latest member
Sadeabdoue
Back
Top