Program Bintang Segitiga Siku Siku
#include <stdio.h>
int main(){
int a,b,n;
printf ("Masukkan Tinggi Segitiga: ");scanf("%d",&n);
for (a=0;a<=n;a++)
{
for (b=1;b<=a;b++){
printf("*");
}
printf("\n");
}
}
int main(){
int a,b,n;
printf ("Masukkan Tinggi Segitiga: ");scanf("%d",&n);
for (a=0;a<=n;a++)
{
for (b=1;b<=a;b++){
printf("*");
}
printf("\n");
}
}
2. Program Bintang Segitiga Siku Siku Terbalik
#include <stdio.h>
int main(){
int a,b,n;
printf ("Masukkan Tinggi Segitiga: ");scanf("%d",&n);
for (a=0;a<=n;a++)
{
for (b=a;b<=n;b++){
printf("*");
}
printf("\n");
}
}
int main(){
int a,b,n;
printf ("Masukkan Tinggi Segitiga: ");scanf("%d",&n);
for (a=0;a<=n;a++)
{
for (b=a;b<=n;b++){
printf("*");
}
printf("\n");
}
}
3. Program Bintang Segitiga Sama Kaki
#include <stdio.h>
int main(){
int a,b,n;
printf ("Masukkan Tinggi Segitiga: ");scanf("%d",&n);
for (a=0;a<=n;a++)
{
for (b=a;b<=n;b++){
printf(" ");
}
for (b=1;b<=a;b++){
printf("*");
}
for (b=1;b<a;b++){
printf("*");
}
printf("\n");
}
}
int main(){
int a,b,n;
printf ("Masukkan Tinggi Segitiga: ");scanf("%d",&n);
for (a=0;a<=n;a++)
{
for (b=a;b<=n;b++){
printf(" ");
}
for (b=1;b<=a;b++){
printf("*");
}
for (b=1;b<a;b++){
printf("*");
}
printf("\n");
}
}
4. Program Bintang Segitiga Sama Kaki Terbalik
#include <stdio.h>
int main(){
int a,b,n;
printf ("Masukkan Tinggi Segitiga: ");scanf("%d",&n);
for (a=0;a<n;a++)
{
for (b=0;b<a;b++){
printf(" ");
}
for (b=a;b<n;b++){
printf("*");
}
for (b=a;b<n-1;b++){
printf("*");
}
printf("\n");
}
}
int main(){
int a,b,n;
printf ("Masukkan Tinggi Segitiga: ");scanf("%d",&n);
for (a=0;a<n;a++)
{
for (b=0;b<a;b++){
printf(" ");
}
for (b=a;b<n;b++){
printf("*");
}
for (b=a;b<n-1;b++){
printf("*");
}
printf("\n");
}
}
5. Program Bintang Jajar Genjang
#include <stdio.h>
int main(){
int a,b,n;
printf ("Masukkan Tinggi Jajar Genjang: ");scanf("%d",&n);
for (a=1;a<=n;a++)
{
for (b=1;b<=a;b++){
printf(" ");
}
for (b=1;b<=a;b++){
printf("*");
}
for (b=a;b<n;b++){
printf("*");
}
printf("\n");
}
}
int main(){
int a,b,n;
printf ("Masukkan Tinggi Jajar Genjang: ");scanf("%d",&n);
for (a=1;a<=n;a++)
{
for (b=1;b<=a;b++){
printf(" ");
}
for (b=1;b<=a;b++){
printf("*");
}
for (b=a;b<n;b++){
printf("*");
}
printf("\n");
}
}
6. Program Bintang Jajar Genjang Terbalik
#include <stdio.h>
int main(){
int a,b,n;
printf ("Masukkan Tinggi Jajar Genjang: ");scanf("%d",&n);
for (a=1;a<=n;a++)
{
for (b=a;b<=n;b++){
printf(" ");
}
for (b=1;b<=a;b++){
printf("*");
}
for (b=a;b<n;b++){
printf("*");
}
printf("\n");
}
}
int main(){
int a,b,n;
printf ("Masukkan Tinggi Jajar Genjang: ");scanf("%d",&n);
for (a=1;a<=n;a++)
{
for (b=a;b<=n;b++){
printf(" ");
}
for (b=1;b<=a;b++){
printf("*");
}
for (b=a;b<n;b++){
printf("*");
}
printf("\n");
}
}
7. Program Bintang Belah Ketupan
#include <stdio.h>
int main(){
int a,b,n;
printf ("Masukkan Tinggi Belah Ketupat: ");scanf("%d",&n);
for (a=1;a<=n;a++)
{
for (b=a;b<=n;b++){
printf(" ");
}
for (b=1;b<=a;b++){
printf("*");
}
for (b=1;b<a;b++){
printf("*");
}
printf("\n");
}
for (a=1;a<n;a++)
{
for (b=0;b<=a;b++){
printf(" ");
}
for (b=a;b<n;b++){
printf("*");
}
for (b=a;b<n-1;b++){
printf("*");
}
printf("\n");
}
}
int main(){
int a,b,n;
printf ("Masukkan Tinggi Belah Ketupat: ");scanf("%d",&n);
for (a=1;a<=n;a++)
{
for (b=a;b<=n;b++){
printf(" ");
}
for (b=1;b<=a;b++){
printf("*");
}
for (b=1;b<a;b++){
printf("*");
}
printf("\n");
}
for (a=1;a<n;a++)
{
for (b=0;b<=a;b++){
printf(" ");
}
for (b=a;b<n;b++){
printf("*");
}
for (b=a;b<n-1;b++){
printf("*");
}
printf("\n");
}
}
0 Comments