class
DoWhile1
{
public static void main(String[] args)
{
int n=5; //5b uah bilangan positif pertama
int hasil=0;
int i=1;
do
{
System.out.print(i);
if (i !=n)
{
System.out.print("+");
}
else
{
System.out.print("=");
}
hasil +=i;
i++;
}
while (i<=n);
System.out.println(hasil);
}
}
0 komentar:
Post a Comment