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

Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?

2 Answers   Excel,


What is static and volatile in c?

0 Answers  


What is a void pointer? When is a void pointer used?

0 Answers   Aspire, Infogain,


Every time i run a c-code in editor, getting some runtime error and editor is disposing, even after reinstalling the software what may be the problem?

2 Answers  


What is Memory leakage ?

2 Answers   HCL,






Reverse a string word by word??

9 Answers  


What are the scope of static variables?

0 Answers  


What is %d called in c?

0 Answers  


What are the types of assignment statements?

0 Answers  


What math functions are available for integers? For floating point?

0 Answers  


What is substring in c?

0 Answers  


What is local and global variable in c?

0 Answers  


Categories