import javax.swing.*;
public class squareofsubscript
{
public static void main(String[] args) {
int n,sq,i;
n=Integer.parseInt(JOptionPane.showInputDialog("enter size "));
for( i=0; i<=n; i++)
{
sq=i*i;
System.out.print(" \nsqaure of subscript of a["+i+"] is" +sq);
}
}
}
public class squareofsubscript
{
public static void main(String[] args) {
int n,sq,i;
n=Integer.parseInt(JOptionPane.showInputDialog("enter size "));
for( i=0; i<=n; i++)
{
sq=i*i;
System.out.print(" \nsqaure of subscript of a["+i+"] is" +sq);
}
}
}
output:
enter size 6
sqaure of subscript of a[0] is0
sqaure of subscript of a[1] is1
sqaure of subscript of a[2] is4
sqaure of subscript of a[3] is9
sqaure of subscript of a[4] is16
sqaure of subscript of a[5] is25
sqaure of subscript of a[6] is36
No comments:
Post a Comment
SAY HELLO!!