## prime number problem in c programming

#include<stdio.h> int main(){ int n, i = 3, count, c;  printf(“Enter the number of prime numbers requiredn”); scanf(“%d”,&n);  if ( n >= 1 ) { printf(“First %d prime numbers are :n”,n); printf(“2n”); }  for ( count = 2 ; count <= n ; ) { for ( c = 2 ; c <= i – 1 …

## REVERSE A NUMBER IN C LANGUAGE

#include <stdio.h>   int main() { int n, reverse = 0;   printf(“Enter a number to reversen”); scanf(“%d”,&n);   while (n != 0) { reverse = reverse * 10; reverse = reverse + n%10; n = n/10; }   printf(“Reverse of entered number is = %dn”, reverse);   return 0; }

## LCM & HCF

#include <stdio.h> int main() { int a, b, x, y, t, gcd, lcm;  printf(“Enter two integersn”); scanf(“%d%d”, &x, &y);  a = x; b = y;  while (b != 0) { t = b; b = a % b; a = t; }  gcd = a; lcm = (x*y)/gcd;  return 0;}

## FACTORIAL

THERE ARE THREE DIFFERENT METHODS FOR SOLVING FACTORIAL PROBLEM WHICH ARE AS FOLLOWS—– METHOD NO-1–>   # include <stdio.h>  int main(){ int c, n, fact = 1;  printf(“PleasevEnter a number to calculate factorialn”); scanf(“%d”, &n);  for (c = 1; c <= n; c++) fact = fact * c;  printf(“Factorial of %d = %dn”, n, fact);  return …

## Decimal to binary conversion (C programming code)

#include <stdio.h>   int main() { int n, c, k;   printf(“Enter an integer in decimal number systemn”); scanf(“%d”, &n);   printf(“%d in binary number system is:n”, n);   for (c = 31; c >= 0; c–) { k = n >> c;   if (k & 1) printf(“1”); else printf(“0”); }   printf(“n”);   …