How to Count Char on Input Sentence

Saturday, October 10, 2009

This is one ef the C code that will count the char of sentence that we've input before.

#define MAKS 256

int main(void){
    int i, jumkar = 0;
    char teks[MAKS];

    puts("Please insert a sentence (max 256 char): ");
    puts("I'll count sum of char on its sentence. ");
    fgets(teks, sizeof teks, stdin); //input from keyboard
    printf("\n Sum of char = %d\n", jumkar);

    return 0;

And this is the result:


Post a Comment

Copyright © Welcome