Pattern-13

 Pattern13


C Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int numbers,i,j;
    char c='A';
    printf("Enter the Number of rows:");
    scanf("%d",&numbers);
    for(i =0 ; i<numbers; i++)
     {
       for(j=0; j<numbers ; j++)
       {
        printf("%c ",c);
         c++;

       }
        printf("\n");

     }
}



Java Program
import java.util.Scanner;

public class Pattern_13 {

	public static void main(String[] args) {
		Scanner S = new Scanner(System.in);
		System.out.print("Enter Number of Rows:");
		int n = S.nextInt();
		char c = 'A';
		for(int i=0; i<n;i++)
		{
			for(int j=0;j<n;j++)
			{
				System.out.print(c + " ");
				c++;
			}
			System.out.print("\n");
	   }

   }
}

0 Comments:

Post a Comment