Showing posts with label C. Show all posts
Showing posts with label C. Show all posts

Wednesday, November 26, 2014

C Programming for Beginners 18 - Arrays in C









1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <stdio.h>
#include <stdlib.h>

int main()
{
  int MyNumberArray [6] = {20,30,60,50,55,30};

  MyNumberArray[1]=45;

  for(int i=0;i<6;i++)
  {
     printf("element[%d]=%d \n",i,MyNumberArray[i]);
  }


}






















C Arrays Basics Explained with 13 Examples

C Programming/Arrays

C Programming Arrays

C Arrays with examples

Arrays in C ProgrammingSearches related to Arrays in C

arrays in c ppt

arrays in c pdf

pointers in c

strings in c

multidimensional arrays in c

2d arrays in c

string arrays in c

char arrays in c

Wednesday, November 19, 2014

C Programming for Beginners 12 - do...while loop in C













1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <stdlib.h>
int main()
{
  int i=0;

  do
  {
    printf("Value of i= %d\n",i);
     //i=i+1;
     i++;
  } while (i > 10);

  printf("********************\n");

  int j=0;
  while (j > 10)
  {
     printf("Value of j= %d\n",j);
     //j=i+1;
     j++;
  }

}




For, While and Do While Loops in C

C Programming while and do...while Loop

Do while loop

C Tutorial   for loop, while loop, break and continue

C do while loop in C programming with example

do-while loop

do-while Statement (C)

C Programming | do-while loop - C

Tuesday, November 18, 2014

C Programming for Beginners 11 - While loop in C









1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include <stdio.h>
#include <stdlib.h>
int main()
{
  int i=0;

  while (i <= 10)
  {
     printf("Value of i= %d\n",i);
     //i=i+1;
     i++;
  }

}














C Programming while and do...while Loop

For, While and Do While Loops in C

C Tutorial – for loop, while loop, break and continue

C: WHILE STATEMENT

C – while loop in C programming with example

C Programming Infinite While Loop

C Programming for Beginners 10 - Switch Statement in C











1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>
int main()
{
  int marks=75;

  switch (marks)
  {
  case 97:
  case 95:
  case 90:
  case 85:
    printf("Excellent");
    break;
  case 75:
  case 70:
    printf("Very Good");
    break;
  case 60:
    printf("good");
    break;
  case 40:
    printf("Ok");
    break;
  default:
    printf("Grade unavailable");
  }
}










switch Statement (C)

C Programming switch...case Statement -

Switch Case in C and C++

C Tutorial – The if and switch statement

C switch case rules - C Programming

Wednesday, November 12, 2014

C Programming for Beginners 9 - The ternary (conditional) operator in C










 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include <stdio.h>
#include <stdlib.h>
int main()
{
///The ternary (conditional) operator in C
 int a=25,b=20;
 int c ;
 ///(/* logical expression goes here */) ? (/* if non-zero (true) */) : (/* if 0 (false) */)
 c = (a > b) ? b : a;
 printf("ans = %d",c);
}










ternary operator bash
how to use ternary operator in c
associativity of ternary operator in c
Verwandte Suchanfragen zu ternary operator
ternary operator java
ternary operator php
ternary operator c++
ternary operator ruby
ternary operator perl
ternary operator python
javascript ternary operator

Sunday, November 9, 2014

C Programming for Beginners 8 - if...else and Nested if...else stateme...











#include <stdio.h>
#include <stdlib.h>
int main()
{
 int age;
 printf("Please enter the age ");
 scanf("%d",&age);
 if (age > 18/* condition goes here */) {
      /* if the condition is non-zero (true), this code will execute */
      printf("The age is greater then 18 \n");
     if(age < 21)
     {
         printf("The age is greater then 18 but less then 21");
     }else{
       printf("The age is greater then 18 but not less then 21");
     }

   } else if (age == 18)
   {
       printf("The age is equal to 18");
   } else
   {
      printf("The age is not greater then or equal to 18");
   }


}

C Programming for Beginners 7 - If Statements in C





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

int main()
{
 int age;
 printf("Please enter the age ");
 scanf("%d",&age);
 if (age > 18/* condition goes here */) {
      /* if the condition is non-zero (true), this code will execute */
      printf("The age is greater then 18");
   }
 if (age == 18/* condition goes here */) {
      /* if the condition is non-zero (true), this code will execute */
      printf("The age is equal to 18");
   }
if (age < 18/* condition goes here */) {
      /* if the condition is non-zero (true), this code will execute */
      printf("The age is less then 18");
   }
}





C Programming for Beginners 7 - If Statements in C


















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

int main()
{
 int age;
 printf("Please enter the age ");
 scanf("%d",&age);
 if (age > 18/* condition goes here */) {
      /* if the condition is non-zero (true), this code will execute */
      printf("The age is greater then 18");
   }
 if (age == 18/* condition goes here */) {
      /* if the condition is non-zero (true), this code will execute */
      printf("The age is equal to 18");
   }
if (age < 18/* condition goes here */) {
      /* if the condition is non-zero (true), this code will execute */
      printf("The age is less then 18");
   }
}





Wednesday, December 25, 2013

C program for Calculation of the surface and the volume of a cone


C program for Calculation of the surface and the volume of a cone



#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
 float r,h;
 float sa,volume;
 clrscr();

 printf("Enter length of radius and height of cone:\n");
 scanf("%f\n%f",&r,&h);
 
 sa=3.141*r*(r+sqrt(r*r+h*h));
 volume=(1.0/3)*3.141* r * r * h;
 printf("Surface area of cone is: %.3f",sa);
 printf("\nVolume of cone is : %.3f",volume);

 getch();
}





OUTPUT:

Enter size of radius and height of a cone: 3 10
Surface area of cone is: 126.672
Volume of cone is: 94.248






-----------------------------------------
Write a c program to find the volume and surface area of cone
C Program to Find the volume and surface area of cone
java programe find volume and surface area of a cone
C Language And Numerical Methods
How to calculate Volume, Curved Surface Area and Total Surface
How to write a C program to find the surface area and volume of a cone
C Program to Find the volume and surface area of cone

Write a C program to calculate roots of a quadratic equation

Write a C program to calculate roots of a quadratic equation



#include<stdio.h>
#include<math.h>

int main(){
  float a,b,c;
  float d,root1,root2;  

 
  printf("Enter a, b and c of quadratic equation: ");
  scanf("%f%f%f",&a,&b,&c);
   
  d = b * b - 4 * a * c;
  
  if(d < 0){
    printf("Roots are complex number.\n");

    printf("Roots of quadratic equation are: ");
    printf("%.3f%+.3fi",-b/(2*a),sqrt(-d)/(2*a));
    printf(", %.3f%+.3fi",-b/(2*a),-sqrt(-d)/(2*a));
  
    return 0; 
  }
  else if(d==0){
   printf("Both roots are equal.\n");

   root1 = -b /(2* a);
   printf("Root of quadratic equation is: %.3f ",root1);

   return 0;
  }
  else{
   printf("Roots are real numbers.\n");
  
   root1 = ( -b + sqrt(d)) / (2* a);
   root2 = ( -b - sqrt(d)) / (2* a);
   printf("Roots of quadratic equation are: %.3f , %.3f",root1,root2);
  }

  return 0;
}








-----------------------------
C PROGRAMMING SOLVING THE QUADRATIC EQUATION
How do you write a c program to solve quadratic equation
Write the C program that solve the quadratic equation problem
Searches related to write a c program to solve quadratic equation
how to write a java program that solves quadratic equations
write a c program to find the roots of a quadratic equation
write a c program to find the real roots of a quadratic equation
c programming quadratic equation roots
c program to find the roots of a quadratic equation with output
quadratic equation c programming code
quadratic equation program in c language
quadratic formula in c programming
Write a C program to to find real roots of the quadratic

write a C Program to arrange 10 numbers in ascending order

C Program to arrange 10 numbers in ascending order





/*C Program to arrange 10 numbers in ascending order*/


#include<stdio.h>

#include<conio.h>

void main()

{

int i,j,temp,a[10];

clrscr();

printf(Enter 10 integer numbers: \n);

for(i=0;i<10;i++)

scanf(%d,&a[i]);

for (i=0;i<10;i++)

{

for(j=i+1;j<10;j++)

{

if(a[i]>a[j])

{

temp=a[j];

a[j]=a[i];

a[i]=temp;

}

}

}

printf(“\n\nThe 10 numbers sorted in ascending order are: \n);

for(i=0;i<10;i++)

printf(%d\t,a[i]);

getch();

}




OUTPUT:


Enter 10 integer numbers:

2

9

7

4

3

6

8

1

5

10

The 7 numbers sorted in ascending order are:

1     2       3       4       5            6       7       8       9      10





------------------------------------------------
Answers questions like


   
Write a c program to sort 10 numbers in ascending order
Write a program to arrange a list of numbers in ascending order
How to write a program for arranging numbers in ascending order
Write a c program to arrange numbers in ascending order
C++ Arrange 10 random integers in descending order? 
Write a C program to sort a string in ascending order.?
Program to sort numbers in ascending order and use integer point
Sort 10 Numbers In Ascending Order - C And C++
Write a simple program in java to accept 10 number

Wednesday, December 4, 2013

Write a C program to Make Simple calculator


Write a C program to Make Simple calculator




#include<stdio.h>
int main() {
  int num1,num2,opt;
  printf("Enter the first Integer:\n");
  scanf("%d",&num1);
  printf("Enter the second Integer:\n");
  scanf("%d",&num2);
  
  for(;;) {
    printf("\n\n\n\nEnter the your option:\n");
    printf("1-Addition.\n2-Substraction.\n3-Multiplication.\n4-Division.\n5-Exit.\n");
    scanf("%d",&opt);
    switch(opt) {
      case 1:
        printf("\nAddition of  %d and %d is: %d",num1,num2,num1+num2);
        break;
        
      case 2:
        printf("\nSubstraction of %d  and %d is: %d",num1,num2,num1-num2);
        break;
        
      case 3:
        printf("\nMultiplication of %d  and %d is: %d",num1,num2,num1*num2);
        break;  
      
      case 4:
        if(num2==0) {
          printf("OOps Devide by zero\n");
        } else {
          printf("\n Division of %d  and %d is: %d",num1,num2,num1/num2);
        }  
        break;
        
      case 5: 
        return 0;
        break; 
        
      default:
        printf("\n Enter correct option\n");
        break; 
    }
 }
 return 0;
}









--------------------------------------------
 Write a program performing as calculator
 Simple calculator - C Programming Examples
 C Program for simple calculator
 Example of C Program/Code to Simulate a simple calculator
 C Program: Make a Calculator
 Write c program to make calculator 

Saturday, September 21, 2013

Installing Eclipse IDE with C/C++ plugin(or CDT) in Ubuntu Linux

Installing Eclipse IDE with C/C++ plugin(or CDT) in Ubuntu Linux










C++

  1. Write a C++ program to Make Simple calculator
  2. Write a C++ program to arrange 10 numbers in ascending order
  3. Write a C++ program to calculates the following equation for entered numbers (n, x). 1+ (nx/1!) - (n(n-1)x^2/2!)
  4. Write a C++ program to 1. Initialize Matrices 2. Print Matrices 3. Multiply Matrices 4. Transpose of 2nd Matrix 5. Move Row and Column of 2nd Matrix 6. Quit
  5. Write the C++ program for processing of the students structure
  6. Write a C++ program that gets two strings from input and stores them in variables such as str1 and str2
  7. Write a C++ program that gets one text with the maximum of 256 characters from input and converts it to standard format based on the following rules and prints the final standardized text
  8. C++ Mini-Project: Human Resource Management Program
  9. Write a C++ program to Solve Quadratic equation
  10. C++ program for Calculation of the surface and the volume of a cone
  11. C++ Program to show Fibonacci Series
  12. C++ Program for Decimal to Hexadecimal Conversion
  13. C++ program to convert decimal number into binary
  14. C++ PROGRAM TO CHECK WHETHER A NUMBER IS NOT A PERFECT NUMBER OR NOT
  15. C++ program to find prime numbers in a given range
  16. C++ program to find Armstrong number
  17. C++ program to find prime number
  18. C++ program to convert a string into upper-case or lower-case
  19. C++ program to concatenate strings
  20. How to Run and install the mongo c++ drivers (MongoDB) On Ubuntu Linux
  21. How to Install Crypto++ Library with the Eclipse IDE on UBUNTU12.10 OS.
  22. Build and Run Sample Code Using Log4Cpp from Source Code on Ubuntu
  23. C++ counting the number of lines in a text file
  24. How do you implement the factorial function in C++
  25. C++ program to find HCF n LCM of two numbers
  26. The most elegant way to split a string in C++
  27. C++ Program for Printing 1 to 1000 without loop
  28. PASS BY REFERENCE C++ EXAMPLE
  29. C++ PROGRAM TO FIND WHETHER A NUMBER IS EVEN OR ODD
  30. C++ code to print all odd and even numbers in given range
  31. C++ Program to Check Palindrome Number
  32. C++ code to get sum of all odd numbers in given range
  33. C++ program to find ASCII Code for Characters and numbers
  34. Compiling and Integrating Crypto++ into the Microsoft Visual C++ Environment + Running Sample program
  35. Write a c++ program that calculates the average of three numbers
  36. C++ program compute hourly pay taking overtime into account
  37. C++ program to print 5 rows of 10 stars
  38. Write a C++ program that can print a temperature conversion
  39. Write a C++ program to construct a pyramid of stars
  40. C++ PROGRAM FOR RANDOM NUMBER GENERATOR
  41. Program for climbing worm program in c++
  42. C++ Program to display current date and time
  43. A C++ program to print the half pyramid
  44. C++ program to print pyramid of numbers
  45. C++ program to print pyramid of numbers
  46. C++ program to make a hollow square using loops
  47. Write a C++ Program for Calculating Slope of a Line Given Two End Points
  48. How to install Package build-essential on Ubuntu Linux
  49. Installing Eclipse IDE with C/C++ plugin(or CDT) in Ubuntu Linux
  50. How to Install, Build and Use the Boost C++ libraries in eclipse IDE on UBUNTU LINUX
  51. Write a C++ Program Banking Record System
C++ Conversion
----------------------------------------------------
Searches related to cdt plugin eclipse IDE
C/C++ On Eclipse
UBUNTU: Installing C/C++ plugin(or CDT) in Eclipse
cdt plugin eclipse juno
 How to install eclipse c++ ide?
eclipse CDT
 how do i install eclipse IDE and CDT
Thread: How do I install eclipse c++ plugin?
cdt plugin eclipse europa
eclipse cdt plugin download
zylin cdt eclipse plugin
eclipse cdt plugin url
No C++ option after install Eclipse CDT
eclipse c++ plugin install
eclipse c++ plugin download
eclipse c ide


How to install Package build-essential on Ubuntu Linux




















-----------------------------------------------------------
Searches related to build essential ubuntu terminal
download build essential for ubuntu
ubuntu 11.04 build essential
What's the command to install the build-essential
ubuntu 11.10 build essential
ubuntu 12.04 build essential
ubuntu build essential installieren
sudo apt-get install build-essential does not work
Package build-essential is not available

Thursday, June 13, 2013

C program to check even or odd

C determine odd or even


#include<stdio.h>

int main(){

    int number;
    int min,max;
  
    printf("Enter the minimum range: ");
    scanf("%d",&min);

    printf("Enter the maximum range: ");
    scanf("%d",&max);

    printf("Odd numbers in given range are: ");
    for(number = min;number <= max; number++)

         if(number % 2 !=0)
             printf("%d ",number);
  
    return 0;

}



output:
Enter the minimum range: 1
Enter the maximum range: 20
Odd numbers in given ranges are: 1 3 5 7 9 11 13 15 17 19






#include<stdio.h>

int main(){

    int number;
  
    printf("Enter any integer: ");
    scanf("%d",&number);

    if(number % 2 ==0)
         printf("%d is even number.",number);
    else
         printf("%d is odd number.",number);
  
    return 0;

}

output:
Enter any integer: 5
5 is odd number.




----------------------------------------
C program to check even or odd
 C determine odd or even
 How to check odd number in c
 How to determine odd or even in c
 C even odd test
 Display odd numbers in c
 How to print odd numbers in c
Even and odd numbers program in c
 C program to find even or odd
Sum of odd numbers in c
 Sum of odd and even numbers c program

C program to find Armstrong number

C program for finding Armstrong numbers

#include<stdio.h>
int main(){
    int num,r,sum=0,temp;

    printf("Enter a number: ");
    scanf("%d",&num);

    temp=num;
    while(num!=0){
         r=num%10;
         num=num/10;
         sum=sum+(r*r*r);
    }
    if(sum==temp)
         printf("%d is an Armstrong number",temp);
    else
         printf("%d is not an Armstrong number",temp);

    return 0;
}




output:
Enter a number: 153
153 is an Armstrong number


--------------------------------------------------
  • Warp to check a number is Armstrong
  • C program to check whether a number is Armstrong or not
  • Simple c program for Armstrong number
  • Armstrong number in c with output
  • Write a c program for Armstrong number
  • C program for Armstrong number generation
  • How to find Armstrong number in c
  • Code for Armstrong number in c
  • C program to print Armstrong numbers from 1 to 500
  • C program for finding Armstrong numbers
  • Armstrong number c program
  • C program to generate and print armstrong numbers
  • C Program to Find whether Number is a Armstrong Number
  • C program to find Armstrong number

Monday, April 1, 2013

Write a C program to check whether a given number is prime or ...

C program to find prime numbers



#include<stdio.h>

int main(){

    int num,i,count=0;
    printf("Enter a number: ");
    scanf("%d",&num);
    for(i=2;i<=num/2;i++){
        if(num%i==0){
         count++;
            break;
        }
    }
   if(count==0 && num!= 1)
        printf("%d is a prime number",num);
   else
      printf("%d is not a prime number",num);
   return 0;
}

output:
Enter a number: 11
11 is a prime number
-----------------------------------------------
Write a C++ program to find prime numbers between  answers .Write a C Program to check number is Prime number . How can you write a program that will determine if the.Program to print first n prime numbers in c.?
C program to determine prime number. Determining if a number is prime in c. C program to find given number is prime or not

C Program to find the perfect numbers between a given range

C PROGRAM TO FIND PERFECT NUMBERS IN GIVEN RANGE


#include<stdio.h>
int main(){
  int n,i,sum;
  int min,max;

  printf("Enter the minimum range-: ");
  scanf("%d",&min);

  printf("Enter the maximum range-: ");
  scanf("%d",&max);

  printf("Perfect numbers in the given range are-: ");
  for(n=min;n<=max;n++){
    i=1;
    sum = 0;

    while(i<n){
      if(n%i==0)
           sum=sum+i;
          i++;
    }

    if(sum==n)
      printf("%d ",n);
  }

  return 0;
}

output:
Enter the minimum range: 1
Enter the maximum range: 30
Perfect numbers in given range is: 6 28
------------------------------------------------
This program is used to check whether a given number is a perfect number or not. The program is to find all the perfect numbers inside the user defined range.

Find out the perfect number using c program

C code to check for a perfect number



#include<stdio.h>
int main(){
  int n,i=1,sum=0;

  printf("Enter a number: ");
  scanf("%d",&n);

  while(i<n){
      if(n%i==0)
           sum=sum+i;
          i++;
  }
  if(sum==n)
      printf("%d is a perfect number",i);
  else
      printf("%d is not a perfect number",i);

  return 0;
}



output:
Enter a number: 28
28 is a perfect number

------------------------------------------------
Searches related to C program to check perfect number c++ program to find perfect numbers c program to check whether a number is perfect or not write a c program to check given number is perfect number or not program to find perfect number in c write a c program for perfect number c program function for perfect number c program for perfect no perfect number logic in c
IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ