write a program for odd numbers?

Answer Posted / sharon

WAP in C to print series of odd no. upto the given num. using function and with arguments
#include<stdio.h>
#include<conio.h>
void odd(int);
void main()
{
int num;
clrscr();
printf("enter number");
scanf("%d",&num);
odd(num);
getch();
}
void odd(int num)
{
int i;
clrscr();
printf("od number upto the given numbers are");
for(i=1;i<=num;i++)
{
if(i%2!=0)
{
printf("%d\t",i);
}
}

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

868


Write a program to show the change in position of a cursor using c

835


Is c is a procedural language?

832


Where static variables are stored in memory in c?

745


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3274


Explain can the sizeof operator be used to tell the size of an array passed to a function?

810


Do string constants represent numerical values?

1155


Explain how can a program be made to print the name of a source file where an error occurs?

955


What is structure in c explain with example?

888


Can a void pointer point to a function?

776


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

1033


Explain how can I manipulate strings of multibyte characters?

994


Write a program to print factorial of given number using recursion?

798


Why do we use int main?

850


i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none

840