Line Break Tag

Image
Line Break Tag Line Break टैग, या `<br>` टैग, HTML का एक inline टैग है जिसका उपयोग टेक्स्ट या सामग्री को एक लाइन से दूसरी लाइन पर ले जाने के लिए किया जाता है। जब आप `<br>` टैग का इस्तेमाल करते हैं, तो वहां जहां यह टैग होता है, वहां का टेक्स्ट या सामग्री एक नई लाइन पर आता है। यहां एक उदाहरण है: ```html <p>यह एक लाइन है।<br>यह दूसरी लाइन है।</p> ``` इस उदाहरण में, `<br>` टैग का उपयोग से "यह एक लाइन है।" और "यह दूसरी लाइन है।" को अलग-अलग लाइनों पर दिखाया जाएगा, जबकि `<p>` टैग से दोनों को एक पैराग्राफ के रूप में प्रदर्शित किया जाएगा। इस टैग का उपयोग किसी भी स्थिति में किया जा सकता है जब आपको टेक्स्ट या सामग्री को अलग लाइनों पर रखना हो, जैसे कि पता, कविता, या गाने के बोल। 

C program to count vowels and consonants in a String using pointer

C Program to Count Vowels and Consonants in a String using Pointer

In this tutorial, we will write a C program to count vowels and consonants in a given String using Pointer.

To understand this program you should know the basics of Arrays and pointers in C.

Program to count Vowels and Consonants in String using Pointer

In the following program we have declared a char array str to hold the input string which we store in the array using fgets() function. We have assigned the base address of array (address of first element) to the pointer p. We cycled through all the characters of the input string by using pointer p inside while loop and incrementing the pointer value on every iteration.

#include <stdio.h>
int main()
{
    char str[100];
    char *p;
    int  vCount=0,cCount=0;

    printf("Enter any string: ");
    fgets(str, 100, stdin);

    //assign base address of char array to pointer
    p=str;

    //'\0' signifies end of the string
    while(*p!='\0')
    {
        if(*p=='A' ||*p=='E' ||*p=='I' ||*p=='O' ||*p=='U'
        		||*p=='a' ||*p=='e' ||*p=='i' ||*p=='o' ||*p=='u')
            vCount++;
        else
            cCount++;
        //increase the pointer, to point next character
        p++;
    }

    printf("Number of Vowels in String: %d\n",vCount);
    printf("Number of Consonants in String: %d",cCount);
    return 0;
}

Output:
C Program to Count Vowels and Consonants in a String using Pointer

Comments

Popular posts from this blog

What is HTML Element

O"Level Syllabus Update 2020

What is WWW?