write a program to display sum odd numbers up to 30
Answers
Answered by
1
Answer:
follow me like me Mark me brainliest
Explanation:
/* C Program to Print Sum of Odd Numbers from 1 to N */ #include<stdio.h> int main() { int i, number, Sum = 0; printf("\n Please Enter the Maximum Limit Value : "); scanf("%d", &number); printf("\n Odd Numbers between 0 and %d are : ", number); for(i = 1; i <= number; i++) { if ( i%2 != 0 ) { printf("%d ", i); Sum = Sum + i; } } printf("\n \n The Sum of Odd Numbers from 1 to %d = %d", number, Sum); return 0; }
Similar questions
Math,
3 months ago
Science,
3 months ago
English,
3 months ago
Social Sciences,
6 months ago
Social Sciences,
6 months ago
English,
1 year ago
Science,
1 year ago