To generate star loop 1357 1358

 avatar
unknown
plain_text
3 years ago
565 B
7
Indexable
#include<stdio.h>
#include<conio.h>

void firstLoop(){
    int i,j, temp=1;
    
    for(i=1;i<=4;i++){
        for(j=1;j<=temp;j++){
            printf("*");
        }
        temp+=2;
        printf("\n");
    }
    
}

void secondLoop(){
    int i,j, temps=1;
    
    for(i=1;i<=4;i++){
        for(j=1;j<=temps;j++){
            printf("*");
        }
        if(i%2==0){
            temps = temps + 3;
        }else{
            temps = temps + 2;
        }
        printf("\n");
    }
   
}
int main(){
    
    firstLoop();
    secondLoop();
    return 0;
}
Editor is loading...