473,442 Members | 4,693 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Write an algorithm to display first 10 odd numbers using for loop

Write an algorithm to display first 10 odd numbers using for loop
Oct 30 '19 #1
4 3352
dev7060
638 Expert 512MB
Follow the posting guidelines and mention what you've done so far for this.
Oct 31 '19 #2
AjayGohil
83 64KB
hello try this using for loop

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3.  
  4. void main()
  5. {
  6.       int max,i;
  7.       printf("Enter value of max");
  8.       scanf("%d",&max);
  9.       printf("Odd Numbers : \n");
  10.       for(i=0;i<=max;i++)
  11.        {
  12.            if(i%2==1)
  13.              printf("%d",i);
  14.        }
  15.  
  16. }
Dec 20 '19 #3
SioSio
272 256MB
Set to initial value 1 and increment 2
Expand|Select|Wrap|Line Numbers
  1. for(i=1;i<=19;i+=2)
  2.  
Dec 20 '19 #4
dev7060
638 Expert 512MB
Reason for asking the progress is to see what they have tried so far. And that's how things work in the profesional IT environment. Nonetheless, one can easily find tons of working code snippets on the web for these basic questions.
Dec 23 '19 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: savesdeday | last post by:
In my beginnning computer science class we were asked to translate a simple interest problem. We are expected to write an algorithm that gets values for the starting account balance B, annual...
113
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same...
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
1
by: sivaprasadreddy | last post by:
hi, how to write algorithm in python program?
7
by: isaac86 | last post by:
Can someone tell me how to write an algorithm? How algorithm look like?
6
by: Dinesh Kumar bca | last post by:
Hai...I am a very basic student for C...So many apologies for asking this basic question. My question is, How to write algorithm for the program to given n number is prime number? Please help.......
9
Rabbit
by: Rabbit | last post by:
Introduction The Advanced Encryption Standard is the algorithm that won the National Insitute of Standards and Technology's (NIST) search for a standardized encryption algorithm in 2001. In 2002, it...
0
Rabbit
by: Rabbit | last post by:
Introduction This article shows you how to implement the LZW lossless compression algorithm in VBScript. It can also be used in VBA as is or almost as is. ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.