output will
1
12
123
1234
12345
//mycfiles.wordpress.com #include
#include
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
printf("\n");
for(j=1;j<=i;j++)
printf("%d",j);
}
getch();
}
To reverse the output
12345
1234
123
12
1
//mycfiles.wordpress.com
#include
#include
void main()
{
int i,j;
clrscr();
for(i=5;i>=1;i-)
{
printf("\n");
for(j=1;j<=i;j++)
printf("%d",j);
}
getch();
}
improved::::::
#include
#include
#include
void main()
{
int i,j,k;
printf("Please enter your desired value:");
scanf("%d",&k);
for (i=1; i<=k; i++)
{
for (j=1; j<=i; j++)
printf("%d",j);
printf("\n");
}
printf("Press any key to close.");
getch();
}
/* INPUT: 5
* OUTPUT: 55555
* 54444
* 54333
* 54322
* 54321
*/
import java.io.*;
class SeriesType
{
protected static void main()throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the number of rows: ");
int a=Integer.parseInt(in.readLine()),c=0,d=0;
int b[]=new int[a];
for(int x=0;x<a;x++)
{
System.out.println();
for(d=0;d<a;d++)
{
b[d]=c;
if(c<x)
c++;
}
for(c=0;c<a;c++)
System.out.print(a-b[c]);
c=0;
#include <stdio.h>
#include <conio.h>
void main (void)
{
int i, j, count = 0;
for(i = 0; i<5; i++)
{
for(j = 0; j<= i; j++)
{
count++;
printf("%d",count);
}
printf("\n");
}
getch();
}
int size = 20;
for(int row=1;row<=size;row++){
int a = row;
while(a++ < (size-1)){
System.out.print(" ");
}
int x = 2*row-1;
for(a = row;a<x;a++){
System.out.print(""+(a%10));
}
for(a=x;a>=row;a--){
System.out.print(""+(a%10));
}
System.out.println();
}
try thiss
#include<stdio.h>
main()
{
int i,n,j,k,y;
printf("enter the number :");
scanf("%d",&n);
for (j=n;j>0;j--)
{
for (k=n-j;k>0;k--)
printf(" ");
for (i=1;i<=j;i++)
printf("%d ",i);
for (i=j-1;i>0;i--)
printf("%d ",i);
for (k=n-j;k>0;k--)
printf(" ");
printf("\n");
}
}
public class Test{
/**
* @param args
*/
public static void main(String[] args) {
for(int i = 0; i < 10; i++) {
for (int j = i; j > 0 ; j--) {
System.out.print(j);
}
System.out.println("");
}
}
}
Output:
1
21
321
4321
54321
654321
7654321
87654321
987654321
5432112345
5432 2345
543 345
54 45
5 5
#include <stdio.h>
int main (void)
{ puts ("1 123 12345 134567 12345679");
return 0;
}
#include <stdio.h>
int main (void)
{ puts ("1 121 12321 1234321"); return }
echo 'print a pattern'
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
write a program to print the series 1/12+1/22+.........+1/n2 ?
This is a directive, not a question.
#include
123454321
write a program to print A to Z on screen in c?
echo 'print a pattern'
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
hi question is here, 1 1 2 1 2 3 1 2 3 4
write a program to print the series 1/12+1/22+.........+1/n2 ?
good morning
Yes.
This is a directive, not a question.
You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.
include <stdio.h> int main (void) { puts ("print"); return 0; }
#include