- This topic has 2 replies, 3 voices, and was last updated 15 years, 2 months ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › plz..help me i m a beginner
can anyone plz help me in this program which states
To find the sum of positive odd numbers and the product of positive even numbers less than or equal to 30. (using for,while or do while loop or nested loop using for while or do while statements)
Hi,I am MUNNA studying mca(master of computer applications) in GITAM university at vizag ,andrapradesh state,INDIA.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#include<stdio.h><br /> void main()<br /> {<br /> int a[50],n,temp=1,oddsum=0;<br /> <br /> printf("enter how many elements do u want to enter");<br /> scanf("%d",&n);<br /> printf("enter the numbers");<br /> for(int i=0;i<n;i++)<br /> scanf("%d",&a);<br /> for(i=0;i<n;i++)<br /> {<br /> while((a%2!=0)&&(a>0)&&a<=30)<br /> oddsum=oddsum+a;/*sum of odd numbers*/<br /> <br /> while((a%2==0)&&(a>0)&&a<=30)<br /> temp=temp*a;/*multipliaction of evens*/<br /> }<br /> } |
tution ki velli chaduvu.