Write an algorithm to compute the sum of odd and even numbers up to N.
Answers
Answered by
0
Find the sum of odd numbers and sum of even numbers from 1 to N
#include <stdio.h> #include <conio.h>
void main() { ...
clrscr();
printf("Enter the value of N\n"); scanf ("%d", &N);
for (i=1; i <=N; i++) { ...
printf ("Sum of all odd numbers = %d\n", oddSum); printf ("Sum of all even numbers = %d\n", evenSum); ...
Enter the value of N. Sum of all odd numbers = 25. ...
RUN2. Enter the value of N.
Similar questions
Science,
6 months ago
Computer Science,
6 months ago
Math,
6 months ago
Math,
1 year ago
Chemistry,
1 year ago