c program to convert any three digit number in words In this program if you enter any three digit number like 123 then it will print one hundred twenty three for this you just need the basic knowledge of switch case.Then go through the given program below. #include<stdio.h> int main(){ int first,second,third; printf("enter 3 digit number\n"); scanf("%1d%1d%1d",&first,&second,&third); switch(first%10){ case 1: printf(" one hundred"); break; case 2: printf(" two hundred"); break; case 3: printf(" three hundred"); break; case 4: printf(" four hundred"); break; case 5: printf(" five hundred"); break; case 6: printf(" six hundred"); break; case 7: printf(" seven hundred"); break; case 8: printf(" eight hundred"); break; case 9: printf(" nine hundred"); bre...
c program to remove characters in string except alphabets if you enter any string then it removes all character from string except alphabet. #include<stdio.h> int main() { char line[150]; int i, j; printf("Enter a string: "); gets(line); for(i = 0; line[i] != '\0'; ++i) { while (!( (line[i] >= 'a' && line[i] <= 'z') || (line[i] >= 'A' && line[i] <= 'Z') || line[i] == '\0') ) { for(j = i; line[j] != '\0'; ++j) { line[j] = line[j+1]; } line[j] = '\0'; } } printf("Output String: "); ...
How to print the table of given number by user in c program #include<stdio.h> int main(){ int i,a,c; //a is any number given by user whose table is to be print. printf("enter any number"); scanf("%d",&a); for(i=1;i<=10;i++){ c=a*i; printf("%d*%d=%d\n",a,i,c); } }
Comments
Post a Comment