Monthly Archive: April 2010

C data types 28

Data Types in C

The above video is an extract from the online course – “C Programming: The ultimate guide for beginners” which we are currently working on. Consider subscribing to Youtube channel – Aptuts in order to get latest updates on new videos and online C programming course. Data types in C determine the following:• Range of the data• Type of the data stored• Number of bytes it occupies in memory C supports following data types:• int – occupies 4 bytes of memory in 32-bit compiler• float – occupies 4 byes of memory• double – occupies 8 bytes of memory• char – occupies...

Search first occurrence of element in an array 9

Search first occurrence of element in an array

Write a program in C language that will accepts n of integer values from the user, accepts the integer element to be searched and displays the position of the element in the array. #include #include #include void main() { int arr[100],i,element,no; clrscr(); printf(“\nEnter the no of Elements: “); scanf(“%d”, &no); for(i=0;i

Addition of array elements in C 5

Addition of Array elements

Write a program in C that accepts number of array elements from the user, accepts array element values and calculates the sum/addition of all the array elements. The program should display the value of addition. #include<stdio.h> int main() { int arr[100], i, no,sum=0; clrscr(); printf(“\nEnter the no. of elements: “); scanf(“%d”,&no); for(i=0;i<no;i++) { printf(“\nEnter element %d”,i+1); scanf(“%d”, &arr[i]); } for(i=0;i<no;i++) { sum=sum+arr[i]; } printf(“\nsum of array element: %d”,sum); return 0; } Output: Enter the no. of elements: 5 Enter element 1 : 1 Enter element 2 : 2 Enter element 3 : 3 Enter element 4 : 4 Enter element...

Arithmetic calculator using switch statement 9

Arithmetic calculator using switch statement

#include #include void main() { int choice, no1, no2, result; clrscr(); printf(“\n\n*********************”); printf(“\nArithmetic Calculator”); printf(“\n*********************”); printf(“\n\n1. Addition\n2. Subtraction”); printf(“\n3. Multiplication\n4. Division”); printf(“\n\nEnter your choice: “); scanf(“%d”,&choice); switch(choice){ case 1: printf(“\nEnter the two number:”); scanf(“%d %d”, &no1, &no2); result = no1 + no2; printf(“\nThe Addition of %d and %d is %d”, no1, no2, result); break; case 2: printf(“\nEnter the two number:”); scanf(“%d %d”, &no1, &no2); result = no1 – no2; printf(“\nThe Subtaction of %d and %d is %d”, no1, no2, result); break; case 3: printf(“\nEnter the two number:”); scanf(“%d %d”, &no1, &no2); result = no1 * no2; printf(“\nThe Multiplication of %d...

FREE C Cheatsheet - Speed Up Your C Programming.

FREE C Cheatsheet - Speed Up Your C Programming.

Download a 7-page free cheat sheet for easy and quick access to C Concepts, Snippets, and Syntax.

Thank you! Check you inbox and access your cheat-sheet