Find the best tutors and institutes for C Language

Find Best C Language Classes

No matching category found.

No matching Locality found.

Outside India?

Search for topics

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

IOS Developer

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

Full Stack Developer

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

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.

Related Questions

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

Related Lessons

Some Tricky Questions in C
Can you write two functions in which one executes before main function and other executes after the main function? #pragma startup #pragma exit Where, priority is optional integer value.For user priority...

Sahana D. | 16 Feb

Program to swap the value of two variables without using third variable(simplest way)...
int main() { int a=10,b=20; printf("values of a before swap ="%d,a); printf("values of b before swap ="%d,b); a=a+b; b=a-b; a=a-b; printf("******************"); printf("values of a after swap...

Rohan | 17/11/2018

Advantages of C++ - C++ is a profoundly convenient dialect and is frequently the dialect of decision for multi-gadget, multi-stage application advancement. - C++ is a protest situated programming dialect...
Find C Language Classes near you

Looking for C Language Classes?

Find best C Language Classes in your locality on UrbanPro.

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you

Find Best C Language Classes?

Find Now »

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 25 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 6.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