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
Explain what are the __date__ and __time__ preprocessor commands?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
What are the 4 types of organizational structures?
Describe dynamic data structure in c programming language?
Write a program of prime number using recursion.
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Why functions are used in c?
Explain how can I manipulate strings of multibyte characters?
Explain about the constants which help in debugging?
What is hash table in c?
What is use of #include in c?
i have a written test for microland please give me test pattern
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
How can a string be converted to a number?
Explain what is a const pointer?