#include <stdio.h> int largest(int []); int largest(int arr[5]) { int l,i; l = arr[0]; for(i=1;i<5;i++) { if (arr[i] > l) { l = arr[i]; } else ; //printf(“%d”,l); } return l; } int main() { int i, max; int arr[5]; … Continue reading
#include <stdio.h> int add_num(int, int, int); //function declaration int add_num(int num1, int num2, int num3) //function definition { int num4; num4 = num1 + num2 + num3; //function body return num4; } int main() { int i,x,y,z; printf(“Enter three numbers:\n”); … Continue reading
#include <stdio.h> int main() { int i,j; int r=2,c=3; int arr[3][4]; printf(“Enter Elements:\n”); for(i=0;i<3;i++) { for(j=0;j<4;j++) { scanf(“%d”, &arr[i][j]); } } printf(“Elements of Array:\n”); for(i=0;i<3;i++) { for(j=0;j<4;j++) { printf(“%d \t”, arr[i][j]); } printf(“\n”); } return 0; } ~ “2d_array.c” 28L, … Continue reading
1 #include <stdio.h> 2 int flag=1; 3 int main() 4 { 5 int arr[5]; 6 int i, key; 7 printf(“Enter Array:\n”); 8 for(i=0;i<5;i++) 9 { 10 scanf(“%d”, &arr[i]); 11 } 12 printf(“Elements of array:\n”); 13 for(i=0;i<5;i++) 14 { 15 printf(“Araray … Continue reading
1 #include <stdio.h> 2 int main() 3 { 4 int i,a,b; 5 printf(“enter a decimal number\n”); 6 scanf(“%d”, &a); 7 for(i=0;i<=32;i++) 8 { 9 b=a%2; 10 printf(“binary number is %d\n”, b); 11 a=a/2; 12 } 13 return 0; 14 } … Continue reading
1 #include <stdio.h> 2 int main() 3 { 4 int i=0; 5 int j=1; 6 printf(“%d”, i); 7 printf(” %d”,j); 8 int k,a,sum; 9 for (k=0;k<=10;k++) 10 { 11 sum=i+j; 12 a=sum; 13 i=j; 14 j=a; 15 printf(” %d”,sum); 16 … Continue reading
1 head 2.1; 2 access; 3 symbols; 4 locks 5 emblogic:1.1; strict; 6 comment @ * @; 7 8 9 1.1 10 date 2015.02.21.05.39.49; author emblogic; state Exp; 11 branches; 12 next ; 13 14 15 desc 16 @This programme … Continue reading
#include<stdio.h> int main() { int a,b,c,d,e,largest,smallest; printf(“enter five integers\n”); scanf(“%d%d%d%d%d”, &a,&b,&c,&d,&e); largest = a; if (b > largest) { largest=b; } if (c > largest) { largest=c; } if (d > largest) { largest=d; } if (e > largest) { … Continue reading
1 #include <stdio.h> 2 int main() 3 { 4 int a,b,c, pay1, pay2, pay; 5 printf(“enter daily working hours\n”); 6 scanf(“%d”, &a); 7 b= a * 6; 8 printf(“weakly hours are %d\n”, b); 9 if (b > 40) … Continue reading
1 #include <stdio.h> 2 int main() 3 { 4 int side, base, height,choice,AOT,AOS; 5 printf(“enter side\n”); 6 scanf(“%d”, &side); 7 printf(“enter base\n”); 8 scanf(“%d”, &base); 9 printf(“enter height\n”); 10 scanf(“%d”, &height); 11 printf(“1=AOT\n”); 12 printf(“2=AOS\n”); 13 scanf(“%d”,&choice); 14 switch(choice) 15 … Continue reading
1 #include <stdio.h> 2 int main() 3 { 4 long int a=0; 5 long int n; 6 printf(“enter a number\n”); 7 scanf(“%ld”, &n); 8 while(n!=0) 9 { 10 a=a*10; 11 a=a+(n%10); 12 n=n/10; 13 } 14 printf(“%ld”,a); 15 return 0; … Continue reading
1 #include <stdio.h> 2 int main() 3 { 4 int a; 5 printf(“enter a number\n”); 6 scanf(“%d”, &a); 7 if(a > 0) 8 { 9 printf(“it is positive\n”); 10 } 11 else if(a < 0) 12 { 13 printf(“it is … Continue reading
1 #include<stdio.h> 2 int main() 3 { 4 float feet, inch,feet1,feet2,inch1,inch2; 5 printf(“enter 1st distance in feet\n”); 6 scanf(“%f”, &feet1); 7 printf(“enter 1st distance in inches\n”); 8 scanf(“%f”, &inch1); 9 printf(“enter 2nd distance in feet\n”); 10 scanf(“%f”, &feet2); 11 printf(“enter … Continue reading
#include <stdio.h> int main() { int year; printf(“enter year\n”); scanf(“%d”, &year); if(year % 4==0 || year % 100== 0) printf(“it is leap year\n”); else printf(“it is non leap year\n”); return 0; }
#include <stdio.h> int main() { int a,i; printf(“enter a number\n”); scanf(“%d”, &a); for (i=0;i<=a;i++) { a=a/2; } if (a%2==0) printf(“it is power of 2\n”); else printf(“it is not\n”); return 0; }