Program Menghitung jumlah karakter dan spasi


Posting kali ini saya akan share bagaimana cara menghitung jumlah karakter dalam sebuah kalimat… kali ini saya tidak menggunakan library string yakni strlen (untuk menghitung jumlah karakter). tapi saya disini memanfaatkan penggunaan fungsi percabangan if, fungsi getchar, dan looping while…
langsung aja berikut Scriptnya:

#include<stdio.h>
#include<conio.h>
main()
{
char kar,kalimat;
int jumkar=1, jumspasi=0;
printf(“\tMasukkan sebuah kalimat : “);
scanf(“%c”,&kalimat);
while((kar = getchar()) != ‘\n’){
// jumlah karakter yang diinput tambah 1 hingga menemukan karakter enter
jumkar++;
// jika terdapat karakter spasi,maka variabel akan dihitung  1
if (kar == ‘ ‘) jumspasi++;
}

printf(“\n\tJumlah karakter\t= %d”, jumkar);
printf(“\n\tJumlah spasi\t= %d\n”, jumspasi);
}

Semoga Membantu trimakasih.. Good Luck!!!


48 thoughts on “Program Menghitung jumlah karakter dan spasi

  1. gan, saya coba menampilkna hasil scanf ke lcd pake lcd_putsf tapi gagal
    ini codenya :

    lcd_clear();
    printf(“masukkan karakter :”);
    scanf(“%c”,&data);
    lcd_putsf(data);

    error gan :
    Error: E:\tes\serial.c(363): function argument #1 of type ‘unsigned char’ is incompatible with required parameter of type ‘flash unsigned char *’

    kenapa ya?
    thanks

  2. Majority with the hotels are situated on the
    heart of your city so there is certainly no communication trouble through the hotels.
    They do last longer than stainless steel bearings
    used in the past. There are 18 Golf Courses near the Marriott Resort and Swim Spa Hotel
    of Pattaya.

  3. The Luxembourg Gardens are the Parisian version of London’s Hyde Park and NYC’s Central Park.

    The shipping is made free all over India with additional discounts on holiday seasons.

    Recently, Chef Bellanger explained to me, “When we started Mad Mac in 2006, cupcakes were the thing, they were exploding,” he explains, “like macarons had done in France years before.

  4. Most men are not into gifts actually, but because you took effort in preparing unique presents for them, their prospective may likely to change.
    For this reason, most of the companies like the above mentioned are desperately waiting to revert to the request they receive for baby free gifts or baby
    gifts online. Now comes the second part; what you choose to
    give as a gift and what it signifies.

  5. This article discusses the best indoor tanning lotions
    on the market today. But manage on previously than you go off to get
    hold of a pair that in form you the best as a result of you earliest have to have to master about about what in truth can help make swimwear alluring and retains
    it from presently staying dull. Find the latest trends for
    summer, tips on wearing plus size leggings, tips on dresses for every occasion and three ways
    to wear one shirt.

  6. Also known as “the pearl of orient” is a dream destination not only for the people of the country but even people from across
    the globe. The standard laboratory testing techniques performed are for experimental studies usually assigned as projects.

    These kinds of Chinese young ladies advertised as masseurs aren’t only terrific in massage,
    but they are pleasing to watch initially.

  7. My spouse and I stumbled over here different website and thought I might check things out.
    I like what I see so i am just following you. Look forward to checking out your web page repeatedly.

  8. Hi there, You’ve done an excellent job. I’ll certainly digg
    it and personally suggest to my friends. I am confident they’ll be benefited from
    this website.

  9. magnificent issues altogether, you simply won a new reader.
    What could you suggest in regards to your put up that
    you just made some days in the past? Any positive?

  10. When someone writes an paragraph he/she retains the
    idea of a user in his/her brain that how a user can know it.
    So that’s why this post is perfect. Thanks!

  11. Heya i’m for the primary time here. I found this board and
    I in finding It really helpful & it helped me
    out much. I am hoping to present something back and help others such as you
    aided me.

  12. I was recommended this blog by my cousin. I am no longer positive whether this submit is written through
    him as no one else recognize such unique about my problem.
    You are wonderful! Thanks!

  13. Hi there! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results.

    If you know of any please share. Thank you!

  14. If some one needs to be updated with newest technologies after that he must be pay a visit this site and
    be up to date all the time.

  15. Hi, I think your blog might be having browser compatibility issues.
    When I look at your website in Opera, it looks fine but when opening in Internet Explorer, it
    has some overlapping. I just wanted to give you a quick heads up!
    Other then that, very good blog!

  16. Wonderful beat ! I would like to apprentice whilst you amend your website, how could i subscribe
    for a weblog site? The account helped me a applicable deal.
    I have been a little bit familiar of this your broadcast provided bright clear concept

  17. Hey! I know this is kinda off topic nevertheless I’d figured
    I’d ask. Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa?
    My blog addresses a lot of the same topics as yours and I believe we could
    greatly benefit from each other. If you are interested
    feel free to shoot me an email. I look forward to hearing from you!
    Excellent blog by the way!

  18. Thanks for every other informative blog. The place else may I
    am getting that kind of information written in such an ideal manner?
    I have a undertaking that I am simply now running on, and I’ve been at the look out for such info.

  19. Hi! I understand this is somewhat off-topic but I needed to ask.
    Does running a well-established blog such as yours take a massive amount work?
    I’m completely new to running a blog however I do write in my journal every day.
    I’d like to start a blog so I will be able to share my own experience and thoughts online.
    Please let me know if you have any suggestions or
    tips for brand new aspiring blog owners. Appreciate it!

  20. Hello! I’ve been reading your site for a long
    time now and finally got the bravery to go ahead and give you
    a shout out from Porter Texas! Just wanted to say keep up the great work!

  21. I’m pretty pleased to uncover this great site. I want to to thank you for ones
    time for this fantastic read!! I definitely enjoyed every bit of
    it and I have you saved as a favorite to check out new things on your website.

  22. Pretty portion of content. I simply stumbled upon your website
    and in accession capital to assert that I get actually loved account
    your weblog posts. Any way I will be subscribing in your feeds
    and even I success you get entry to constantly quickly.

  23. Hmm is anyone else encountering problems with the images on this blog loading?
    I’m trying to find out if its a problem on my end or if it’s the blog.
    Any suggestions would be greatly appreciated.

  24. What i do not realize is in truth how you are not really much more neatly-preferred than you
    may be right now. You’re so intelligent. You know thus considerably
    relating to this topic, produced me individually consider it from a lot of numerous angles.

    Its like women and men don’t seem to be interested except it is something to accomplish with Girl
    gaga! Your own stuffs nice. Always care for it up!

  25. I love to walk, but when I first moved to Bangkok, Thailand, the incredible heat made
    me think I’d probably never go for a walk again. ‘ Condoms must be used when taking anti-biotics.
    The new drug, called Xiaflex, is the first non-surgical treatment for men with an erect curvature deformity of at least 30 degrees.

  26. Many guys are asking about surgery only to locate out
    the huge expenses involved, together with the very small chances of success.
    For the people that happen to be wanting to see long lasting
    and safe and sound results from their how to grow your penis journey then make sure you keep away from these 3 ‘so referred to as solutions’ in any way costs.
    Prostate massagers can also be found that will aid in prostate stimulation that can promote a healthy prostate and lead to stronger erections.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s