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

What is a #include preprocessor?

850


How to declare a variable?

805


we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

956


Are negative numbers true in c?

814


explain how do you use macro?

938


code for replace tabs with equivalent number of blanks

1946


Between macros and functions,which is better to use and why?

1843


Can a local variable be volatile in c?

793


Difference between malloc() and calloc() function?

923


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

956


What is methods in c?

863


How are structure passing and returning implemented?

814


What is character set?

949


What is malloc() function?

873


What are two dimensional arrays alternatively called as?

972