/*determine the pattern 1234321*/
#include<stdio.h>
#include<conio.h>
main()
{
int i, j;
for (i=1; i<=7; i++)
{
if (i<5)
{
j=i;
printf("\n %d", j);
}
else
{
j=8-i;
printf("\n %d", j);
}
}
getch()
}
int i, j;for (i=3; i>0; --i) {
for (j=1; j<i; ++j)
printf ("%d", j);
for (;j>0; --j)
printf ("%d", j);
printf("\n");
}
#include#includevoid main(){clrscr();for (int i=1;i
for (int i=0; i<3; ++i) printf ("1 1 0 "); printf("1\n");
If you visualize 1123581321 as a set of numbers (without spaces in between) instead of one number, you'll see that it's a set of the first 8 Fibnocci nos. - 1 1 2 3 5 8 13 21. The following program would print the required no. using a For looping structure. int main (void) { int i=1; int j=1; int k, num=1; for(k=0; k<7; k++){ if(k==0){ printf("%d", num); } printf("%d", num); //next no. is the sum of previous two nos. in the series i=j; j=num; num=i+j; // 1 + 1 = 2 ... 1 + 2 = 3 ... 2 + 3 = 5 ... 3 + 5 = 8 // sum=i + j ... i takes value of j ... j takes value of sum ... repeat. } }
0
1) source program to object program 2)object program to object program output
123454321
#include <iostream> int main() { std::cout << "1 121 12321 1234321" << std::endl; return 0; }
As the World Turns - 1956 1-12321 was released on: USA: 10 August 2004
The factors of 121 are 1•121 and 11•11 :)
Total = 10000(1+i)n Total = 10000(1.2321)2 Total = 12321 Change = interest gained = 12321 - 10000 = 2321
#include#includevoid main(){clrscr();for (int i=1;i
1, 11 and 121
1, 11, 121, -1, -11, -121
121^1 = 121. Any number with an exponent of 1 is equal to itself.
The factors of 121 are 1, 11, and 121.
The divisors of 121 are: 1, 11, 121.
- 121 = -121