Showing posts with label c program. Show all posts
Showing posts with label c program. Show all posts

Friday, March 28, 2014

Get Your IP By C Program!

Share Post:
This program will read your IP from system and then prints it on the screen.
#include<stdio.h>
#include<stdlib.h>

int main()
{
   system("C:\\Windows\\System32\\ipconfig");

   return 0;
}

Monday, March 17, 2014

Find Maximum Element In Array

#include <stdio.h>
#include <conio.h>

int main()
{
  int array[100], max, size, i, loc = 1;

  printf("Input number of elements in array\n");
  scanf("%d", &size);

Sunday, March 16, 2014

Check Anagram in C

#include <stdio.h>
#include<conio.h>
int check_anagram(char [], char []);

int main()
{
   char s1[110], s2[110];
   int cond;

   printf("Enter first string\n");
   gets(s1);

   printf("Enter second string\n");
   gets(s2);

Thursday, March 13, 2014

C program in order to reverse a number

This program reverses the number given as input by the user. Eg. if user enters 123 the output will be 321.
By Siddique Hassan.

#include <stdio.h>
#include<conio.h>
int main()
{
   int n, reverse = 0;

   printf("Enter a number to reverse\n");
   scanf("%d",&n);

Sunday, March 9, 2014

C program to concatenate strings without strcat(function)

#include <stdio.h>
#include<conio.h>

void concatenate_string(char*, char*);

int main()
{
    char original[100], add[100];

    printf("Enter source string\n");
    gets(original);

C program to print Pascal triangle

#include <stdio.h>
#include<conio.h>

long factorial(int);

int main()
{
   int i, n, c;

   printf("Enter the number of rows you wish to see in pascal triangle\n");
   scanf("%d",&n);

Saturday, March 8, 2014

C program to find either the entered alphabet is vowel or not

#include <stdio.h>
#include<conio.h>
int main()
{
  char ch;

  printf("Enter a character\n");
  scanf("%c", &ch);

C program to check leap year

C program to find whether the year entered by user is a leap year or not.

#include <stdio.h>
#include<conio.h>
int main()
{
  int year;

  printf("Enter a year to check if it is a leap year\n");
  scanf("%d", &year);

C program to print Floyd's triangle.

This program prints Floyd's triangle. Number of rows of Floyd's triangle to print is entered by the user. First four rows of Floyd's triangle are as follows :-
1
2 3
4 5 6
7 8 9 10

#include <stdio.h>
#include<conio.h>
int main()
{
  int n, i,  c, a = 1;

Friday, March 7, 2014

C program to print Fibonacci series

In Fibonacci series, except first two terms in sequence every other term is the sum of two previous terms, For example 8 = 3 + 5 (addition of 3, 5). This sequence has many applications in mathematics and Computer Science.

#include<stdio.h>
#include<conio.h>
int main()
{
   int n, first = 0, second = 1, next, c;

   printf("Enter the number of terms\n");
   scanf("%d",&n);

Thursday, March 6, 2014

C program to find armstrong number

A number is armstrong if the sum of cubes of individual digits of a number is equal to the number itself. For example 371 is an armstrong number as 3^3 + 7^3 + 1^3 = 371.
#include <stdio.h>                                                     //header file
#include<conio.h>                                                    //header file
int main()
{                                                                                 //start of main body
   int number, sum = 0, temp, remainder;

Wednesday, March 5, 2014

Basic C program to print sum of squares of 4 numbers

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,sumsq;
    printf("\nEnter 1st number...");
    scanf("%d",&a);
    printf("\nEnter 2nd number...");

C program to find a palindrome number

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,revers=0,temp;
    printf("Enter the number...");
    scanf("%d",&n);

C program to print sum of even numbers upto 10

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a, sum=0;
    for(a=1; a<=10; a++)

C program to reverse a number

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,num;
    printf("enter the 2-digit number");