C Program To Find Sum of All Odd Numbers From 1 To N, using For loop

preview_player
Показать описание

Lets write a C program to find sum of all the odd numbers from 1 to N, using for loop.

An odd number is an integer that is not exactly divisible by 2.

For Example: 7 % 2 != 0. When we divide 7 by 2, it doesn't give a reminder of 0. So number 7 is odd number.

C Programming Interview / Viva Q&A List

C Programming: Beginner To Advance To Expert
Рекомендации по теме
Комментарии
Автор

Thank you!! I had been trying to write to program to print first ten even numbers, and find their sum, in c++, this video helped me a lot

aik_naaa
Автор

Bro can u pls make a video on oops .that how data is hidden n worked in program

kartikhosamani
Автор

as u show in video i'd try it all as same as u written, in my case i write it all same in DevC++ programme!! but only determined number is coming, sum of numbers is not coming.. plz tell me a reason and solution..

naitikkathiriya
Автор

Is this true,
For(i=1 ;i<=n ; i++){
If (i%2==0){
Break;}
Sum=sum+i;}

lulusemeer