Calculator using C programming
#include<stdio.h> #include<math.h> int add(a, b) { printf("Please enter two number for add: \n"); scanf("%d%d",&a,&b); printf("%d + %d = %d\n",a,b,(a+b)); return 0; } int sub(a, b) { printf("Please enter two…
#include<stdio.h> #include<math.h> int add(a, b) { printf("Please enter two number for add: \n"); scanf("%d%d",&a,&b); printf("%d + %d = %d\n",a,b,(a+b)); return 0; } int sub(a, b) { printf("Please enter two…
#include <stdio.h> int main(){ int i,j, n; printf("Please enter a number: "); scanf("%d", &n); for(j=0;j<n;j=j+1){ for(i=0;i<j+1;i=i+1){ printf("*"); } printf("\n"); } return 0; }
#include <stdio.h> #include <stdlib.h> int main(){ int num,rev=0; printf("Please enter a integer."); scanf("%d", &num); while(num){ rev = rev*10+num%10; num = num/10; } printf("Result is : %d", rev); return 0; }
#include <stdio.h> #include <stdlib.h> int main(){ int a, i, limit, sum=0; printf("Please Enter a initial digit."); scanf("%d", &a); printf("Please Enter limit.\n"); scanf("%d", &limit); for(i=a;i<=limit;i++){ if(i%2!=0){ printf("%d+", i); sum=sum+i; } }…
#include<stdio.h> void main(){ //declaring integer type variables int limit, i, first=0, second=1, next=0; //displaying message to enter the limit printf("Enter the limit: "); //storing the limit into a variable scanf("%d",&limit);…
#include <stdio.h> #include <stdlib.h> int main(){ int num, num2, sum=0; printf("Please enter a integer."); scanf("%d", &num); num2=num; while(num){ sum = sum*10+num%10; num = num/10; } if(sum==num2){ printf("This number is Palindrome.");…
#include <stdio.h> #include <stdlib.h> int main(){ int a, b, c; printf("Please enter your numbers: \n"); scanf("%d%d%d", &a, &b, &c); if(a!=b && b!=c){ if(((a<b) &&(b<c)) || ((c<b) && (b<a))){ printf("' %d…
#include <stdio.h> #include <stdlib.h> int main(){ int a, b, c; printf("Please enter your numbers: \n"); scanf("%d%d%d", &a, &b, &c); if(a!=b && b!=c){ if(((a<b) &&(b<c)) || ((c<b) && (b<a))){ printf("' %d…
#include <stdio.h> #include <stdlib.h> int main(){ int bd, bm, by, cd, cm, cy, ad, am, ay; printf("Please give me your date of birth \n"); printf("day \t"); scanf("%d", &bd); printf("month \t");…
#include <stdio.h> #include <stdlib.h> int main(){ int a; printf("Please enter a year: \n"); scanf("%d,", &a); if(a%4==0 && a%100!=0){ printf("You entered %d and this is a leap year. \n", a); }…