Write a C program to display odd numbers from 1 to n where n is accepted from user?

1 answer

Answer

1054472

2026-09-05 18:15

+ Follow

#include<stdio.h>

main()

{

int i=0,j=0,n;

printf("Enter a number:");

scanf("%d",&n);

printf("The first %d odd numbers are:-\n");

for(i=0;i<=n;i++)

{

if(j%2!=0)

printf("%d\n"j);

j=j+1;

}

}

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.