Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.3k views
in Computer by (15 points)
Write a program to calculate and print the sum of odd numbers and the sum of even
numbers for the first N natural numbers.
The integer N is to be entered by the user.

Please log in or register to answer this question.

1 Answer

0 votes
by (56.3k points)

main ( )
{
int x;
printf ("enter x value");
scanf (" %d",&x);
if (x%2==0)
printf ("the number is even");
else
printf ("the number is odd");
}

Related questions

+1 vote
1 answer
asked Sep 15, 2022 in Computer by saify2910 (35 points)
0 votes
1 answer
asked Jun 16, 2023 in JAVA by Mohamed111 (15 points)
0 votes
1 answer
asked Sep 15, 2022 in Computer by Nakul01 (36.4k points)
0 votes
0 answers
asked Jul 3, 2022 in Computer by Shash (25 points)

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...