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
What is enumerated data type in c?
#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); }
What is a pointer and how it is initialized?
What do you mean by command line argument?
What is the difference between mpi and openmp?
What is ## preprocessor operator in c?
Which header file is used for clrscr?
Why isnt any of this standardized in c?
What is action and transformation in spark?
What is the argument of a function in c?
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
Is malloc memset faster than calloc?
What does & mean in scanf?
How can I sort more data than will fit in memory?
Are the variables argc and argv are local to main?