UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How to write a C program to print the series 1,9,17, 33,49,73,97?

Asked by Last Modified  

Follow 2
Answer

Please enter your answer

iOS Trainer and Developer, C++, Advanced C++, C, Core Java Trainer

The series is like adding 8 * x for two numbers and then incrementing x by 1 so that 8 is doubled. 1, (1+8*1) 9, (9+8*1) 17, (17+ 8 * 2) 33, (33 + 8 * 2) 49 and so on. So it will be like: int main() { // Series to print: 1,9,17, 33,49,73,97..... int multiplier = 8; int...
read more
The series is like adding 8 * x for two numbers and then incrementing x by 1 so that 8 is doubled. 1, (1+8*1) 9, (9+8*1) 17, (17+ 8 * 2) 33, (33 + 8 * 2) 49 and so on. So it will be like: int main() { // Series to print: 1,9,17, 33,49,73,97..... int multiplier = 8; int reset = 0; int seriesNumber = 1; int limit = 0; printf("Print the limit of series = "); scanf("%d",&limit); printf("%d",seriesNumber); for(int i=1;i= 2) { multiplier += 8; reset = 1; } else { reset++; } seriesNumber += multiplier; printf(", %d",seriesNumber); } return 0; } I am sure the code can be improved too. Output is attached. read less
Comments

Full Stack Developer

1, (1+8*1) 9, (9+8*1) 17, (17+ 8 * 2) 33, (33 + 8 * 2) 49 and so on.
Comments

Full Stack Developer

#include "stdio.h" int main(void) { int i=0,j=1, sum=1; while(sum lessthan 200){ i++; printf("%d\n",sum); sum = sum + (8*j); if(i == 2){ i=0; j=j+1; } } return 0; } Please use lessthan symbol in loop condition as this input does not accepts html tag symbols.
Comments

View 1 more Answers

Related Questions

How can you check to see whether a symbol is defined?
You can use the #ifdef and #ifndef preprocessor directives to check whether a symbol has been defined (#ifdef) or whether it has not been defined (#ifndef).
Name

What is void main () into main and what it does?

Void main () is the entry point for execution in C program. The void is a keyword that represents function will not return anything but a void value. Main is the name of the function and () represents...
Noreen
Is a default case necessary in a switch statement?
NO, default is optional and you can omit it if there is no use of it.
My
What are the __DATE__ and __TIME__ preprocessor commands?
The standard predefined macros are specified by the relevant language standards, so they are available with all compilers that implement those standards. Older compilers may not provide all of them. Their...
Subhasish
What are the applications of C programming?
Hi Poulami Hope you are doing good. C programming language is a versatile and widely used language that has found applications in various domains. Some of the key applications of C programming include: 1....
Poulomi
0 0
6

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Some interview questions and answers for fresher level on Pointers
What is a void pointer? Void pointer is a special type of pointer which can reference or point to any data type. This is why it is also called as Generic Pointer. As a void pointer can point to...

Design your own Mouse Driver in C Language
Mouse Driver (msdrv.h) #include #include union REGS i,o; restrictmouseptr(int x1, int y1, int x2, int y2) { i.x.ax=7; i.x.cx=x1; i.x.dx=x2; ...

C Program-Temperature [conversion from farenheit to degree celsius]
//WAP to convert temperture from farenheit into degree celsius //Header files#include<stdio.h>#include<conio.h> //Main functrion void main(){ //Variable declaration of type float float...

Why Indexing Should Start From Zero In Array ?
Why numbering should start at zero? To denote the subsequence of natural numbers 2, 3, ..., 12 without the pernicious three dots, fourconventions are open to usa) 2 ≤ i < 13b) 1 < i ≤ 12c)...

C for Begginers
C is an procedure oriented programming language. For any begginer the word program is new. Program: Set of instructions to be followed by machine or computer. Instruction Examples: Arithmetic instruction...

Recommended Articles

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more