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


Please Help Members By Posting Answers For Below Questions

What is enumerated data type in c?

611


#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }

705


What is a pointer and how it is initialized?

592


What do you mean by command line argument?

632


What is the difference between mpi and openmp?

721






What is ## preprocessor operator in c?

602


Which header file is used for clrscr?

565


Why isnt any of this standardized in c?

624


What is action and transformation in spark?

582


What is the argument of a function in c?

563


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

734


Is malloc memset faster than calloc?

603


What does & mean in scanf?

591


How can I sort more data than will fit in memory?

617


Are the variables argc and argv are local to main?

778