Q3. WAP in C to input n numbers in an array, find out the sum of odd nos. and even nos. Display the numbers whose sum is high.
WAP in C to input n numbers in an array, find out the sum of odd nos. and even nos.Display the numbers whose sum is high.
int limit,i,sum=0;
setbuf(stdout,NULL);
printf("Enter a limit");
scanf("%d",&limit);
for(i=1;i<=limit;i++){
if(i%2!=0){
printf("%d
", i);
sum=sum+i;
}
}
printf("The sum of odd numbers from 0 to %d are :%d",limit,sum);
Code Example |
---|
C :: write the data in perticulare memmory loaction in C |
C :: c michael |
C :: online code runner .c |
C :: Example of header file c |
C :: python to c converter online free |
C :: program to merge two strings in c |
C :: c Modulo 10^9+7 (1000000007) |
C :: buildCheckFunction(locations) |
C :: too many arg |
C :: fscanf stops at space |
C :: C static libraries (creating archive from object files) |
C :: c++ sum of ascii string |
C :: wordpress clean name spaces |
C :: vbl share price |
C :: linked list in c |
C :: time random c |
C :: unox reclame harmonica tabs |
Dart :: flutter sleep |
Dart :: flutter divider |
Dart :: flutter switch color |
Dart :: showdialog with builder flutter |
Dart :: add bg image to scaffold flutter |
Dart :: flutter cliprrect |
Dart :: how to take integer input from user in dart |
Dart :: dart random password generator |
Dart :: clickable card flutter |
Dart :: DartPad localStorage |
Dart :: text field validation in flutter |
Dart :: flutter safearea |
Dart :: how to launch url in flutter web |