Question

C-language software: What are its inputs? What are its outputs? What decisions does the software have...

C-language software:

What are its inputs?

What are its outputs?

What decisions does the software have to make?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is a c-language software that will prompt user to enter two string (Software's input).

Now this software will compare and decide if the string are reverse of each other or not. (Software's decision)

Finally it will print if the string's are revserse to each other or not (Software's output).

Example:

suppose two strings are dog and god.

now it will reverse one of the entered string let's say first one

than first string will be : god and second is god already.

Now it will compare each character with other string character if all characters are same than it will print string are reverse to each other,else it will print strings are not reverse to each other.

Please have a look of code below:

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

#include <stdio.h>

#include <string.h>

int main(int argc, char** argv)

{

//declare two strings

char string1[100];

char string2[100];

printf("Enter string 1 : ");

scanf("%s",string1);

printf("Enter string 2 : ");

scanf("%s",string2);

//check if lengths are not same

if(strlen(string1)!=strlen(string2)){

printf("The string are not the reverse of each other");

return 0;

}

//now check for each character

long unsigned length = strlen(string1);

long unsigned i;

for(i=0;i<length;i++){

if(toupper(string1[i])!=toupper(string2[length-i-1])){

printf("The string are not the reverse of each other");

return 0;

}

}

printf("The string are the reverse of each other");

return 0;

}

output:

Add a comment
Know the answer?
Add Answer to:
C-language software: What are its inputs? What are its outputs? What decisions does the software have...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT