SlideShare uma empresa Scribd logo
1 de 20
http://eglobiotraining.com
The first programming source
code will show how to compute for
the sum of the number entered by
the user by using the C language
programming.




         http://eglobiotraining.com
#include<stdio.h>
#include<conio.h>
main()
{
int num,sum=0,i;
printf("enter integer:");
scanf("%d",&num);
for(i=0;i<=num;i++)
sum=sum+i;
printf("answer is %d",sum);
getch();
}

              http://eglobiotraining.com
The example for this
 programming source Code is
 the user enter number 5. So
 the program will Start to
 compute from 5 and adding
 numbers 4, 3, 2 and 1. So the
 output will be 15.

        http://eglobiotraining.com
Here is the example output of the
programming source code.




              http://eglobiotraining.com
The second programming
 source code will show us an
 output of a right triangle
 depending what the user
 entered in the program and the
 number of asterisk is depends
 also on the number that the
 user entered.

        http://eglobiotraining.com
#include<stdio.h>
#include<conio.h>
int size,j,i;
main()
{
 printf("enter size:");
 scanf("%d",&size);
 for(i=1;i<=size;i++)
 {
for(j=1;j<=i;j++)
printf("*");
printf("n");
}
getch();
}
                 http://eglobiotraining.com
For example the user entered
 number 5 in the program. So
 the programming output will
 show 5 rows of asterisk
 starting from 1 and ends with 5
 asterisk on the fifth row.


        http://eglobiotraining.com
Here is the example output of the programming source
 code.




             http://eglobiotraining.com
The 3rd programming source
 code will determine if the
 number that we enter is a
 prime or not.




        http://eglobiotraining.com
#include<stdio.h>
#include<conio.h>
int r,N,ctr,d;
main()
{
printf("enter number:");
scanf("%d", &N);
ctr=0;
d=1;
do {
r=N%d;
 if(r==0)
 ctr++;
d++;
}while (d<=N);
if(ctr==2)
printf("%d:PRIME", N);
else
printf("%d:NOT PRIME",N);
getch();
}
                http://eglobiotraining.com
For example the user input the number 13. The
 program will start executing if number 13 is prime or
 not. The output of the programming source code is
 that it is a prime.




              http://eglobiotraining.com
The 4th programming source
 code will show us the sum of
 all numbers starting from 1 and
 ending with 10.




        http://eglobiotraining.com
#include<stdio.h>
#include<conio.h>

main()
{

int ctr=1,sum=0;
while(ctr<=10)
{
if(ctr%2!=0)
sum=sum+ctr;
ctr++;
}
printf("sum of all odd numbers from 1 to 10 is %d",sum);
getch();
}




                    http://eglobiotraining.com
If the user starts the programming
  source code, the program will
  automatically calculate the adding oll
  the odd numbers from 1 to 10 and the
  sum is 25.




          http://eglobiotraining.com
The fifth programming source code
 shows the sum of two integers
 and after showing the output, the
 programming source code also
 indicates whether you would like
 to try again or not.



         http://eglobiotraining.com
#include<stdio.h>
#include<conio.h>
main()
{
int num1,num2,sum;
char Resp;
do{
printf("enter 2 numbers:");
scanf("%d %d", &num1, &num2);
sum=num1+num2;
printf("the sum of %d and %d is %dn", num1,num2,sum);
printf("n TRY AGAIN [Y/N]?:");
scanf("%c",&Resp);
} while ((Resp)=='Y');
getch();
}



                 http://eglobiotraining.com
For example for this programming source code:
The user inputed integers 13 and 12. So the program will
  compute the sum of 13 and 12 and the programming
  output is 25.




              http://eglobiotraining.com
http://www.slideshare.net/franzneri/com
 p1




          http://eglobiotraining.com
SUBMITTED TO: MR. ERWIN GLOBIO

SUBMITTED BY: FRANZ NERI CLEMEÑA

FM09205 W-S 10:30AM-12:00PM



Official Website is http://eglobiotraining.com/




                http://eglobiotraining.com

Mais conteúdo relacionado

Mais procurados

Simple c program
Simple c programSimple c program
Simple c programRavi Singh
 
C programming Lab 2
C programming Lab 2C programming Lab 2
C programming Lab 2Zaibi Gondal
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given numberMainak Sasmal
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programsPrasadu Peddi
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1Zaibi Gondal
 
C program to check leap year
C program to check leap year C program to check leap year
C program to check leap year mohdshanu
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentalsZaibi Gondal
 
Testing lecture after lec 4
Testing lecture after lec 4Testing lecture after lec 4
Testing lecture after lec 4emailharmeet
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CBUBT
 
C Language Programs
C Language Programs C Language Programs
C Language Programs Mansi Tyagi
 
Chapter 5 exercises Balagurusamy Programming ANSI in c
Chapter 5 exercises Balagurusamy Programming ANSI  in cChapter 5 exercises Balagurusamy Programming ANSI  in c
Chapter 5 exercises Balagurusamy Programming ANSI in cBUBT
 
Chapter 5 Balagurusamy Programming ANSI in c
Chapter 5 Balagurusamy Programming ANSI  in cChapter 5 Balagurusamy Programming ANSI  in c
Chapter 5 Balagurusamy Programming ANSI in cBUBT
 
Chap 2 input output dti2143
Chap 2  input output dti2143Chap 2  input output dti2143
Chap 2 input output dti2143alish sha
 

Mais procurados (20)

Simple c program
Simple c programSimple c program
Simple c program
 
C Programming
C ProgrammingC Programming
C Programming
 
First c program
First c programFirst c program
First c program
 
C programming Lab 2
C programming Lab 2C programming Lab 2
C programming Lab 2
 
Lab 1
Lab 1Lab 1
Lab 1
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
 
Programming egs
Programming egs Programming egs
Programming egs
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1
 
C program to check leap year
C program to check leap year C program to check leap year
C program to check leap year
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
Ansi c
Ansi cAnsi c
Ansi c
 
Testing lecture after lec 4
Testing lecture after lec 4Testing lecture after lec 4
Testing lecture after lec 4
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in C
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
C Language Programs
C Language Programs C Language Programs
C Language Programs
 
Chapter 5 exercises Balagurusamy Programming ANSI in c
Chapter 5 exercises Balagurusamy Programming ANSI  in cChapter 5 exercises Balagurusamy Programming ANSI  in c
Chapter 5 exercises Balagurusamy Programming ANSI in c
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
Chapter 5 Balagurusamy Programming ANSI in c
Chapter 5 Balagurusamy Programming ANSI  in cChapter 5 Balagurusamy Programming ANSI  in c
Chapter 5 Balagurusamy Programming ANSI in c
 
Chap 2 input output dti2143
Chap 2  input output dti2143Chap 2  input output dti2143
Chap 2 input output dti2143
 

Destaque

Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacjaJakub Szotek
 
Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacjaJakub Szotek
 
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...Jakub Šimko
 
Jsimko wikt2012 v01
Jsimko wikt2012 v01Jsimko wikt2012 v01
Jsimko wikt2012 v01Jakub Šimko
 
Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacjaJakub Szotek
 

Destaque (7)

Health Affairs
Health AffairsHealth Affairs
Health Affairs
 
Html
HtmlHtml
Html
 
Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacja
 
Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacja
 
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
 
Jsimko wikt2012 v01
Jsimko wikt2012 v01Jsimko wikt2012 v01
Jsimko wikt2012 v01
 
Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacja
 

Semelhante a comp1

C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.Haard Shah
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solutionKuntal Bhowmick
 
C Language Programming Introduction Lecture
C Language Programming Introduction LectureC Language Programming Introduction Lecture
C Language Programming Introduction Lecturemyinstalab
 
Control structure of c
Control structure of cControl structure of c
Control structure of cKomal Kotak
 
Compiler design lab
Compiler design labCompiler design lab
Compiler design labilias ahmed
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solutionyogini sharma
 
Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02Suhail Akraam
 
Itp practical file_1-year
Itp practical file_1-yearItp practical file_1-year
Itp practical file_1-yearAMIT SINGH
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfAshutoshprasad27
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxAshutoshprasad27
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...DR B.Surendiran .
 
programs of c www.eakanchha.com
 programs of c www.eakanchha.com programs of c www.eakanchha.com
programs of c www.eakanchha.comAkanchha Agrawal
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans incnayakq
 
Basic of c programming www.eakanchha.com
Basic of c programming www.eakanchha.comBasic of c programming www.eakanchha.com
Basic of c programming www.eakanchha.comAkanchha Agrawal
 

Semelhante a comp1 (20)

C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
 
C faq pdf
C faq pdfC faq pdf
C faq pdf
 
C lab
C labC lab
C lab
 
Hargun
HargunHargun
Hargun
 
C Language Programming Introduction Lecture
C Language Programming Introduction LectureC Language Programming Introduction Lecture
C Language Programming Introduction Lecture
 
C
CC
C
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
 
Unit-IV.pptx
Unit-IV.pptxUnit-IV.pptx
Unit-IV.pptx
 
Compiler design lab
Compiler design labCompiler design lab
Compiler design lab
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
 
Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02
 
Itp practical file_1-year
Itp practical file_1-yearItp practical file_1-year
Itp practical file_1-year
 
PCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdfPCA-2 Programming and Solving 2nd Sem.pdf
PCA-2 Programming and Solving 2nd Sem.pdf
 
PCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docxPCA-2 Programming and Solving 2nd Sem.docx
PCA-2 Programming and Solving 2nd Sem.docx
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
 
C file
C fileC file
C file
 
programs of c www.eakanchha.com
 programs of c www.eakanchha.com programs of c www.eakanchha.com
programs of c www.eakanchha.com
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 
Basic of c programming www.eakanchha.com
Basic of c programming www.eakanchha.comBasic of c programming www.eakanchha.com
Basic of c programming www.eakanchha.com
 

comp1