Computer Science, asked by nidA2980, 8 months ago

एक प्रोग्राम लिखिए, जो किसी मीटिंग को पढ़कर उसे उल्टे क्रम में छापता हो (इसमें strev फंक्शन का उपयोग मत कीजिए)।

Answers

Answered by ridhimakh1219
0

एक प्रोग्राम लिखिए, जो किसी मीटिंग को पढ़कर उसे उल्टे क्रम में छापता हो

Explanation:

C में प्रोग्राम को रिवर्स ऑर्डर में एक स्ट्रिंग प्रिंट करने के लिए।

#include <stdio.h>

#include <string.h>

void main()

{

  char str1[100], tmp;

  int l, lind, rind,i;

      printf("\n\nPrint a string in reverse order:\n ");

      printf("-------------------------------------\n");

  printf("Input a string to reverse : ");

  scanf("%s", str1);

  l = strlen(str1);

  lind = 0;

  rind = l-1;

for(i=lind;i<rind;i++)

      {

      tmp = str1[i];

      str1[i] = str1[rind];

      str1[rind] = tmp;

      rind--;

  }

  printf("Reversed string is: %s\n\n", str1);

}

OUTPUT

Print a string in reverse order:                  

-------------------------------------                                                              

Input a string to reverse : Welcome                                                 Reversed string is: emocleW

Answered by StaceeLichtenstein
0

Following are the program in c language is given below .

Explanation:

#include <stdio.h> // header file

#include <string.h>  // header file

int main()  // main function

{

char str[100];

printf("Enter the string: \n");

scanf("%s",str);  // Read the value by the user

int t= strlen(str);  // calculate the string

printf("\nreverse string:\n");

while(t>=0)  // iterating the loop

{

printf("%c",str[t]);  // display string in reverse order

--t;  

}

return 0;

}

Output:

Enter the string:

metting

reverse string:

gnittem

Following are the description of program

  • Read the string by the user in the "str" variable .
  • Finding the length of the string by using strlen
  • iterating the loop for string reverse the string .
  • Print the character by character in reverse order and decrement the value of t

Learn More :

  • brainly.in/question/8583792

Similar questions