c programming

16
C PROGRAMMING FROM PRESENTED BY SONAKSHI SARKAR

Upload: sonakshi-sarkar

Post on 22-May-2015

129 views

Category:

Education


0 download

DESCRIPTION

learning c programming from ABC

TRANSCRIPT

Page 1: C programming

C PROGRAMMING FROM

PRESENTED BY SONAKSHI SARKAR

Page 2: C programming

A program is set of instructions .

WHAT IS A PROGRAM ?

Page 3: C programming
Page 4: C programming

WHAT IS REQUIRED TO WRITE

A PROGRAM ?

Ans : Computer language (which is C in this case )

Page 5: C programming

Alphabets Digits and Special symbols

Constants Variables and keywords

Instructions

Program

STEPS IN LEARNING C

Page 6: C programming

C constants

Primary constants

Integer constants

Real constants

Character constants

Secondary constants

Array

CONSTANTS

Page 7: C programming

VARIABLES

ENTITY THAT VARIES DURING PROGRAM EXECUTION

Page 8: C programming
Page 9: C programming

OPERATORS

Page 10: C programming
Page 11: C programming
Page 12: C programming
Page 13: C programming

program header comment

preprocessor directives (if any)

int main ( void ) { statement(s) return 0 ; }

Anatomy of a C Program

Page 14: C programming

/* Filename: hello.c Author: BT 414 Date written: 17/10/2011 Description: This program prints the greeting

“Hello, World!” */

#include <stdio.h>

int main ( void ) { printf ( “Hello, World!\n” ) ; return 0 ; }

A Simple C Program

Page 15: C programming

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

printf("Enter a number you want to check.\n”); scanf("%d",&num); if((num%2)==0) //checking whether remainder is 0 or not. printf("%d is even.",num); else printf("%d is odd.",num); return 0; }

Output 1Enter a number you want to check. 25 25 is odd.Output 2Enter a number you want to check. 2 2 is even.

Page 16: C programming