10.01.2012

Square number program and flowchart

Q. Write a C program to accept a number from user and print the square of number. Also draw the flowchart of program.

Ans.

/*c program to calculate the square of number*/
#include<stdio.h>
int main()
{
 double n,z;
 printf("Enter any number : ");
 scanf("%lf", &n);
 z = n * n;
 printf("Square of number %lf*%lf = %lf",n,n,z);
 return 0;
}

The output of above program would be:

Enter any number : 25
Square of number 25*25 = 625


Flowchart of above C square number program:


Flowchart of square number C program
Figure : Flowchart for square number C program

Related programs:

  1. What is Algorithm and Flowchart
  2. Basic of Algorithm
  3. Flowchart for search prime number
  4. Factorial C program, Algorithm and Flowchart
  5. Flowchart for check a number is Armstrong number or not

5 comments:

  1. Write a C program to accept a number from user and print the sum of square. Also draw the flowchart of program.

    ReplyDelete
    Replies
    1. Your required sum of square C program, algorithm and flowchart at:

      http://cprogrammingcodes.blogspot.in/2012/10/sum-of-square-program-algorithm-and.html

      Delete
  2. write a c program that input 4 digit number and giving output its reverse order for example the no is 1234 it shows as 4321. also draw its flow chart

    ReplyDelete
  3. Are Flowcharts necessary for an experenced iphone Programmer?

    ReplyDelete