C Program to Sort set of strings in alphabetical order

#include<stdio.h> #include<string.h> int main(){ int i,j,count; char str[25][25],temp[25]; puts(“How many strings u are going to enter?: “); scanf(“%d”,&count); puts(“Enter Strings one by one: “); for(i=0;i<=count;i++) gets(str[i]); for(i=0;i<=count;i++) for(j=i+1;j<=count;j++){ if(strcmp(str[i],str[j])>0){ strcpy(temp,str[i]); strcpy(str[i],str[j]); strcpy(str[j],temp); } } printf(“Order of Sorted Strings:”); for(i=0;i<=count;i++) puts(str[i]); return 0; }

an algorithm to check prime number

algorithm

An algorithm to check prime number A number that is divisible only by itself and 1, is prime number Example of prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23…. etc Algorithm Step 1: Start Step 2: Declare variables n,i,flag. Step 3: Initialize variables flag←1 i←2 Step 4: Read n from user. Step … Read more

write a C program to reverse the number

C Programming Tutorial

Problem Statement : If a five-digit number is input through the keyboard, write a program to reverse the number. Answer: /* To reverse the digits of 5-digit number */ #include<stdio.h> #include<conio.h> main() { int n,a,b; long int revnum=0; clrscr(); printf(“\n Enter a five digit number less than 32767”); scanf(“%d”,&n); a=n%10; /*last digit */ n-n/10; /* … Read more