write a program for odd numbers?

Answers were Sorted based on User's Feedback



write a program for odd numbers?..

Answer / 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

write a program for odd numbers?..

Answer / monisha

#include<stdio.h>
#include<conio.h>
void main();
{
int n;
printf("Enter the number",n);
scanf("%d",&n);
for (i=1;i<=n;n+2)
printf("%d",i());
getch();
}

Is This Answer Correct ?    0 Yes 2 No

write a program for odd numbers?..

Answer / nilaksh

#include<stdio.h>
#include<conio.h>
void main()
{
int i, n;
clrscr();
printf("\nHow many odd numbers?");
scanf("%d",&n);
for(i=1;i<=n*2;i++)
printf("\n %d",i);
getch();
}

Is This Answer Correct ?    2 Yes 6 No

write a program for odd numbers?..

Answer / dally

#include<stdio.h>
int main()
{
int n,i;
printf("Enter values for n\n");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
if(i%2 != 0)
printf("%d",i);
}
}

Is This Answer Correct ?    10 Yes 16 No

write a program for odd numbers?..

Answer / sameer.chaudhari

main()
{
int num;

printf("Plz enter the number :=> ");
scanf("%d",&num);

if (num & 1)
printf("odd");
else
printf("even");

getch();
}

Is This Answer Correct ?    22 Yes 43 No

Post New Answer

More C Interview Questions

write a program for fibonaci series by using while loop in c?

2 Answers  


Is c a great language, or what?

0 Answers  


What is dynamic dispatch in c++?

0 Answers  


why effort estimation is important?

1 Answers  


where does it flourished?

0 Answers   Microsoft,


Can we declare variable anywhere in c?

0 Answers  


What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); }

4 Answers   ADITI,


can we access one file to one directory?

1 Answers  


Describe the order of precedence with regards to operators in C.

0 Answers  


How many bytes are occupied by near, far and huge pointers (dos)?

0 Answers  


What does the function toupper() do?

0 Answers  


What are static functions?

1 Answers  


Categories