write a c program for print your name .but,your name may be
small
letter mean print a capital letter or your name may be
capital
letter mean print a small letter .example
\\enter ur name :
sankar
The name is: SANKAR
(or)
enter your name:SAnkar
The name is:saNKAR
Answer Posted / vishnu nayak
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
const char *ptr;
char *temp;
int count =0;
ptr = (char*) malloc(sizeof(char)*30);
temp = (char*) malloc(sizeof(char)*30);
printf("enter the string \n");
gets(ptr);
while(*ptr != '\0')
{
if(*ptr >=65 && *ptr <= 90)
{
*temp = (*ptr)+32;
temp++;
ptr++;
}
else if(*ptr >= 97 && *ptr <= 122)
{
*temp = (*ptr)- 32;
temp++;
ptr++;
}
else
{
*temp = *ptr;
ptr++;
temp++;
}
count++;
}
*temp = '\0';
temp = temp - count;
puts(temp);
free(temp);
free(ptr);
//getch();
}
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
What are the 5 organizational structures?
What does volatile do?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
Combinations of fibanocci prime series
Are the expressions * ptr ++ and ++ * ptr same?
What will the preprocessor do for a program?
What is 1d array in c?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
Explain low-order bytes.
Tell me when is a void pointer used?
Is c call by value?
What is the difference between typedef struct and struct?
What are near, far and huge pointers?
What is declaration and definition in c?