Results 1 to 7 of 7

Thread: Plz Help Me....

  1. #1
    ali134 is offline Junior Member
    Last Online
    2nd July 2017 @ 10:29 PM
    Join Date
    20 Oct 2015
    Age
    20
    Gender
    Male
    Posts
    5
    Threads
    3
    Credits
    44
    Thanked
    0

    Default Plz Help Me....

    Ye 1 program ka solve kr do.. C
    Write a programe to Find Ascii value of a Character please help me

  2. #2
    Join Date
    20 May 2012
    Gender
    Male
    Posts
    6,593
    Threads
    102
    Credits
    22,773
    Thanked
    949

    Default

    Program to Print ASCII Value
    ------------
    #include <stdio.h>
    int main()
    {
    char c;
    printf("Enter a character: ");

    // Reads character input from the user
    scanf("%c", &c);

    // %d displays the integer value of a character
    // %c displays the actual character
    printf("ASCII value of %c = %d", c, c);
    return 0;
    }

  3. #3
    Join Date
    20 May 2012
    Gender
    Male
    Posts
    6,593
    Threads
    102
    Credits
    22,773
    Thanked
    949

    Default

    Output
    ---------
    Enter a character: G
    ASCII value of G = 71

    In this program, user is asked to enter a character which is stored in variable c. The ASCII value of that character is stored in variable c rather than that variable itself.
    When %d format string is used, 71 (ASCII value of 'G') is displayed.
    When %c format string is used, 'G' itself is displayed.

  4. #4
    Motri's Avatar
    Motri is offline Advance Member
    Last Online
    Yesterday @ 11:01 PM
    Join Date
    14 Oct 2013
    Location
    Sargodha
    Age
    20
    Gender
    Male
    Posts
    748
    Threads
    66
    Credits
    1,289
    Thanked
    56

    Default

    #include<stdio.h>
    main()
    { int i;
    for(i=1;i<257;i++)
    printf("%d %c",i,i);
    }
    Evil+angel=world

  5. #5
    Join Date
    20 May 2012
    Gender
    Male
    Posts
    6,593
    Threads
    102
    Credits
    22,773
    Thanked
    949

    Default

    an other porgram
    C Program to find ASCII Value of a Character
    In this program, User is asked to enter any character and this program will display the ASCII value of that character.

    CODE
    /* C Program to find ASCII Value of a Character */
    #include <stdio.h>

    int main()
    {
    char ch;

    printf("\n Please Enter any character \n");
    scanf("%c",&ch);

    printf("\n The ASCII value of given character = %d",ch);
    return 0;
    }

  6. #6
    Join Date
    20 May 2012
    Gender
    Male
    Posts
    6,593
    Threads
    102
    Credits
    22,773
    Thanked
    949

    Default

    C Program to find ASCII value of all Characters
    This program will print ASCII values of all the characters currently present.

    CODE
    /* C Program to find ASCII Value of a Character */
    #include <stdio.h>

    int main()
    {
    int i;

    for(i=0;i<=255;i++)
    {
    printf("The ASCII value of %c = %d\n",i,i);
    }
    return 0;
    }

  7. #7
    Join Date
    20 May 2012
    Gender
    Male
    Posts
    6,593
    Threads
    102
    Credits
    22,773
    Thanked
    949

    Default

    C Program to find Sum of ASCII value in a String
    This program allows the user to enter any valid string and then, this program will display the ASCII value of each individual character present in that string and calculate the Sum of all those ASCII values.

    CODE
    #include <stdio.h>
    #include <string.h>

    void main()
    {
    int i, sum = 0, length;
    char name[50];

    printf("\nPlease Enter any name You wish\n");
    scanf("%s", name);

    while(name[i]!='\0')
    {
    printf("\nThe ASCII value of the Character %c = %d\n",
    name [i], name [i]);
    sum = sum + name [i];
    i++;
    }
    printf("\nSum of all characters : %d ", sum);
    }

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •