Posts

Showing posts with the label flowchart

Program Prime Numbers C Language

Image
Hey everyone, I want to share my experience with C language. This my program will print prime numbers. You simply enter the number of primes that you want to display. And this is the source code. #include<stdio.h> int main(){ int a, n, i, sum, total=0; printf("input how prime should print : "); scanf("%d",&n); for(a=1;total<n;a++){ sum=0; for(i=1;i<=a;i++){ if(a%i==0){ sum++; } } if(sum==2){ printf("%d ",a); total++; } } } It is a program from me, hopefully useful.

Algorithm and Flowchart Simple Calculator

Image
Algorithm :  Initialize val1, val2, oprs, result  Input val1  Input val2  Choose operation (oprs) from +, -, x or :  If you choose operation (+), then the result = val1 + val2  If you select operation (-), then result = val1 - val2  If you select operation (x), then result = val1 * val2  If you select operation (:), then result = val1 / val2  Print results And this is the flowchart :