Posts

Showing posts from 2019

C & C++ LAB PROGRAMS

C-LAB PROGRAMS 1. Program for Arithmetic operator  #include<stdio.h>   int main(  )  {  int a = 9,b = 4, c;  c = a+b;  printf("a+b = %d \n",c);   c = a-b; printf("a-b = %d \n",c);   c = a*b; printf("a*b = %d \n",c);   c=a/b; printf("a/b = %d \n",c);   c=a%b; printf("Remainder when a divided by b = %d \n",c); return 0;  }  2. Program for Armstrong Number     #include<stdio.h> int main(  ) {  int num,r,sum=0, temp; printf("Enter a number: ");  scanf("%d",&num);   temp=num;   while(num!=0) {  r=num%10;   num=num/10;   sum=sum+(r*r*r);  } if(sum==temp)  printf("%d is an Armstrong number",temp);  else printf("%d is not an Armstrong number",temp);   return 0;  }  3. Program For Largest and smallest element in an array   #include<stdio.h> int main(...