Sabtu, 22 November 2025

ex1004.c void graph(int count)

/* ex1004.c */
#include <stdio.h>

void graph(int count);
int main()
{
    int value;
    value=2;
    while(value<=64)
    {
        graph(value);
        printf("Value is %d\n",value);
        value=value*2;
    }
    return(0);
}

void graph(int count)
{
    int x;
    for(x=0;x<count;x=x+1)
    {
        putchar('*');
    }
    putchar('\n');
}

output:
 
**
Value is 2
****
Value is 4
********
Value is 8
****************
Value is 16
********************************
Value is 32
****************************************************************
Value is 64

Process returned 0 (0x0)   execution time : 0.104 s
Press any key to continue.

Tidak ada komentar:

Posting Komentar