# 1 121 12421 1248421 print these in C programming?

Would you like to merge this question into it?

#### already exists as an alternate of this question.

Would you like to make it the primary and merge this question into it?

#### exists and is an alternate of .

the series continues with the length of odd series ie.1,3,5,7...so on.the middle integer is extra sdded in every number.it's general structure is
(inital numbers)(extra number)(reverse of initial numbers)

extra number is always multplied by 2 with last extra number added

char s[50];
s[0]=1;
for(i=1;i<n;i++)
{
traverse the array to next middle position
add the extra element in between the elements
concatenate the reverse part of initial elements
}

this can b done as

for(i=1,j=0;i<n;i=strlen(s),j++)
{
for(k=i;k>j;k--)
{
s[k+1]=s[k];
}

s[j+1]=s[j-1]*2;
s[i+3]='\0';
print s;
}
8 people found this useful

# C program to print prime numbers?

class primenoSeries { void main () { int i = 1; // Used to divide number and check if they are factors or not. int C = 0; // used as a counter for number of factors. int n = 1; // Represent the numbers. while (n > 0) { if ( n % i 0 ) { C++; if ( C 2 && i n) { System.ou (MORE)

# Write a program in C to print 1 -4 7-10 13 -16?

hi here is the program for u. //program to print the series 1,-4,7,-10,13,-16 etc... #include #include void main() { int i,n,sign=1; printf("Enter the number of terms to which u want to print the series\n"); scanf("%d",&n); for(i=1;i

# C program to print multiplication table?

include int main() { int num,i; printf("Enter a number: "); scanf("%d",&num); for(i=1;i

# C program to print how many prime numbers are there from 1 to 50?

Here is a simple program to generate prime numbers upto a given specific number /*Prime No. from 1 to 50*/ /*By-Himanshu Rathee*/ #include #include void main() { int i,j,n; clrscr(); printf(" Enter the number upto which we have to find the prime number: "); scanf("%d",&n); printf (MORE)

# How to write a program to print 1 2 3... series in C?

... char ch; int number = 0; do { . cout

# What is the C program codings for printing triangle?

include. include. main(). {. int i,i=50,r=60;. clrscr();. for(i=0;i

# Write a C program to print Denominations?

in this example I deal with fictive currency namely: Gold, Silver and Copper coins.. 1 Gold is 100 Silver. 1 Silver is 100 Copper (thus 1 gold is 10000 copper). include . include . void denominate(int Copper). {. DWORD myCopper = Copper % 100;. DWORD mySilver = Copper/100 % 100;. DWORD myG (MORE)

# C program to print the calendar for a year?

include int IsLeapYear(int); int DaysPassedFromYear(int, int, int); int GetNumberOfDaysInMonth(int ,int); int main() { int year=2013, month, i; for(month=1;month

# Write a C program to print the following triangle 1 101 10101 1010101?

include using namespace std; void printTriangle(int iterations) { for(int i = 0; i < iterations; i++) { cout

# Write a program to print Armstrong in c?

void main() { int n,b=0,t; clrscr(); printf("Enter the no"); scanf("%d",&n); t=n; while(n>0) { a=n%10; b=b+a*a*a; n=n/10; } if(b==t) { printf("Armstrong no"); } else { printf("Not an Armstrong no"); } getch(); }

# How do you print twin primenumbers in c program?

void PrintTwinPrimes (int p1, int p2) { printf ("%d and %d are twin-primes\n", p1, p2); }

# How can you write a C program which prints itself?

int main (){int c;FILE *f = fopen (__FILE__, "r");if (!f)return 1;for (c=fgetc(f); c!=EOF; c=fgetc(f))putchar (c);fclose (f);return 0;}

# 1 121 12321 1234321 program?

1^2 = 1 11^2 = 121 111^2 = 12321 1111^2 = 1234321 11111^2 = 123454321 #include #include #include void main() { clrscr(); int n;//soullessgod coutn; int a=1,b,s=1; for(;a=1;b--) { cout

# How do you write a program in C plus plus print 1 to 10000 in Roman numerals?

include #include #include std::string decimal_to_roman (unsigned num) { std::stringstream ss {}; while (num>0) { if (num>10000) throw std::range_error ( "ERROR: decimal_to_roman (unsigned num) [num is out of range]"); else if (num10000) { ss

# Write a C program to print the pattern 1 1 2 1 2 3 1 2 3 4?

// Here are three ways to answer your question. Hope it's not a homework assignment!\n. \n// -----Method 1------ //\n . include \n int main() {\nprintf("1121231234");\nreturn 0;\n}\n. \n// -----Method 2------ //\n . include \n int main() {\nint i, j;\nfor(i=1; i

# What is the c plus plus program to print armstrong numbers from 1 to 100?

include #include unsigned count_digits (unsigned num, const unsigned base=10) { unsigned count=1; while (num/=base) ++count; return count; } class number { std::vector value; unsigned base; public: number (const unsigned _value, const unsigned _base=10): value {}, base {_base} { *this = _value; (MORE)

# What is the C plus plus program to print the sum of all squares from 1 to n?

include #include using namespace std; unsigned sum_of_squares (const unsigned max) { if (max0) return 0; if (max1) return 1; return sum_of_squares (max-1) + (max*max); } int main () { unsigned num = 0; while (1) { cout > s; if (s[0]=='0') break; stringstream ss; ss > num) { cout

# A program in c for matrix printing?

//program to get numbers from user and print the matrix #include int main() { int i,n,j,a[10][10]; printf("\n enter the number of elements "); scanf("%d",&n); for(i=0;i

# Write a C program to print the pattern 1 01 101 0101 10101?

include #include void main() { int i,j,k=0,l; clrscr(); for(i=1;i

# C program to print Adam number?

include . include . void main(). {. int i,n,n1,n2,ns,r,rev=0,nr=0,nrs;. clrscr();. printf("Enter a no.n");. scanf("%d",&n);. ns=n;. n1=n*n;. n2=n1;. while(n2>0). {. r=n2%10;. n2=n2/10;. rev=rev*10+r;. }. while(ns>0). {. r=ns%10;. ns=ns/10;. nr=nr*10+r;. }. nrs=nr*nr;. if (rev (MORE)

# C program to print a matrix?

If this is a homework assignment, please consider trying it yourself first. Otherwise, you will lose the value of the reinforcement of the lesson that doing the homework provides. . int matrix[ROWS][COLUMNS]; . int row, column; . for (row=0; row

# C program to print a number in words?

class abc { void main( int num ) { int d = 1; int dig = 0; int temp = num; System.out.println(temp); while(num > 9) { num = num / 10 ; d = d * 10; } while( d != 0) { dig = temp / d; if( dig 1) System.out.print("One"); if( dig 2) System.out.print("Two"); if( (MORE)

# In c program how to print addition from 1-100 numbers?

include using std::cout; using std::endl; int main() { const int numToAdd = 100; int sum = 0; for (int i = 1; i

# How to Write a c plus plus program to print number from 1 to 500?

include using std::cout; using std::endl; int main(viod) { cout

# Write a c program to print he table from 1 to n?

include #include void main() { int printf("\nEnter the no. upto which the multiplication table is to be displayed:"); scanf("%d",&n); for(i=1;i

# Write a C program to print numbers from 1 to 99 in words?

include #include void one(int m) { int n; n=m%10; switch(n) { case 1:printf("One"); case 2:printf("Two"); . . . case 9:........ } } void ten(m) { int a=m%10; switch(m) { case 11:printf("Eleven"); ........ case 15:.... } if(m>15 && m=20 && m=30 && m

# C program to print numbers 1 to n?

how do we use loops in c plus plus programing and what are basic differences between do,for and while loop

# C program to print 1 to 100 divisible by 2 and not divisible by 3 and 5?

include #include main() { int i; /* looping variable */ for(i=1;i

# C program to print the largest digit of a no?

include #include int main(int argc, char *argv[]){ int numval, highval = 0; if(argc != 2){ printf("syntax:\n\tfoo number\n"); exit(1); . } numval = atoi(argv[1]); while(numval > 0){ if(numval % 10 > highval){ highval = numval % 10; . } numval = (int)(numval / 10); . } (MORE)

# How do you print the numbers 1 11 121 1331 14641in pyramid form in c?

include #include #include int count=0; char arr1[20],arr2[20]; int main() { int j; arr1[0]=1; arr1[1]='\0'; int flag=3; for(j=3;j>=-1;j--) printf(" "); printf("1\n"); while(flag>=0) { for(j=3;j>=count;j--) printf(" "); arr2[0]=arr1[0]; arr2[strlen(arr1)]=arr1[strlen(arr1)-1]; for(j=1;j

# How Write a c program to print the following triangle 1 12 123 1234?

Use a double for loop. for(int x=1; x

# What is C program pattern 1 121 12321?

/*determine the pattern 1234321*/ #include #include main() { int i, j; for (i=1; i

# Write a c program to print factorial?

/*program for finding the factorial*/ void main() { int a,b=1; clrscr(); printf("Please enter any number to find its factorial\n"); scanf("%d",&a); while(a>1) { b=b*a; a--; } printf("factorial is %d",b); getch(); }

# C program to print helical matrix?

//the following code will help you to write the program for(i=n-1, j=0; i > 0; i--, j++) //n is the order of the square matrix { for(k=j; k < i; k++) printf("%d ", a[j][k]); for(k=j; k < i; k++) printf("%d ", a[k][i]); for(k=i; k > j; k--) printf("%d ", a[i][k]); for(k=i; k > j; k--) printf (MORE)

# Can you write a C program to print prime numbers from 1 to 100 using for loop?

include #include bool is_prime(unsigned num) { unsigned max, factor; if (num

# C program to print factorial of a number?

include int main(){int c, n, fact = 1;printf("Enter a number to calculate it's factorial\n");scanf("%d", &n);for (c = 1; c

# To print 1 11 121 1331 14441?

include #include void main() { int i,j,sp=0; clrscr(); for(i=5;i>=1;i--) { for(j=1;j

# How you write a program in c plus plus to print plaindromic numbers from 1 to n?

To check if a number is a palindrome, reverse the number and see ifit is equal to the original number. If so, the number is apalindrome, otherwise it is not. To reverse a number, use thefollowing function: int reverse(int num, int base=10) { int reverse=0; while( num ) { reverse*=base; reverse+=nu (MORE)

# A program prints vertically a numbers in c program?

It is too easy................ //Program to print numbers vertically #include #include void main() { int last_no; int i; clrscr(); i=0; printf("Enter your last num.I will print 0 to that number"); scanf("%d",&last_no); printf("\n"); while(i>last_no) { printf("%d\n",i); i++; } getch(); } (MORE)

# Write a c program to print 1 12 123 1234 12345?

include int main (void) { puts ("1 12 123 1234 12345"); return 0; }

# How do you write a c program to print the odd numbers from 1 to 100?

include int main (int argc, char **argv) { int i; for (i=1; i

# How do you write a c program to prints name?

Write a c program that reads your first name and surname when you enter them. Each part of your name should not be more than 12 characters. Finally, have the program display your full name.

# Write a C program to print a name?

include int main(void) { printf("Hello world!"); return 0; } Of course, all you have to do is merely replace "Hello, world!" with your chosen name.

# 1 121 12321 1234321 program with the help of for loop in c?

include int main (void) { int i; for (i=0;i

# How do you write a C program to print the table from 1 to n side by side?

void print1_to_n (unsigned n) { for (unsigned num=1; num

# How do you write a C program to print how many prime numbers there are from 1 to 1000000?

First, you need a function that can determine if a given number isprime or not: #include bool is_prime (unsigned num) { if (num < 2) return false; if (!(num % 2)) return num == 2; // 2 is the only even prime unsigned max = (unsigned) sqrt ((double) num) + 1; for (unsigned div = 3; div < max; div + (MORE)

# What is C program pattern 12321 121 1?

int i, j;for (i=3; i>0; --i) { for (j=1; j0; --j) printf ("%d", j);. printf("\n"); } .

# How do you write a C Program to Print all the Prime Numbers between 1 and 100.?

C does not prove a built-in function to determine if a number isprime or not, thus we must write one. The implementation isreasonably trivial: bool is_prime (unsigned int value) { if (value

# 1 121 12421 1248421 print these in php programming?

Assuming you just want those integers printed you can do so likethis: However, if you're looking for how to print these in some sort ofpower of 2 in terms of a homework assignment, you can pretty easilyfind some hints by simple searching the significance of thosenumbers.

# What is the C program to print the following triangle 1 10 101 1010?

for (int row=0; row