# C – C Programming Question and Solution

0
28

## C – Programming Code to Find (R-1)’s -9’s Complement.

### The (r-1)’s complement.

Write a simple C program to find the (r-1)’s complement or 9’s complement.
Logic – Definition – Given a positive number N in base r with an integer part of n digits and a fraction part of m digits, the (r-1)’s complement of N is defined as rn-r-m-N. Some numerical examples follow. Example. The 9’s complement of (52520)10) is  (105-1-52520)=99999-52520=47479.
`#include<stdio.h>#include<conio.h>void main(){    int n,o;    printf("Enter Number:");    scanf("%d",&n);    if(n<10){      o=10-1-n;      printf("%d",o);    }    else if(n<1000){      o=1000-1-n;      printf("%d",o);    }    else if(n<10000){      o=10000-1-n;      printf("%d",o);    }    else if(n<100000){      o=100000-1-n;      printf("%d",o);    }    else      printf("Sorry I Can't");      getch();}`

## C Program to Find Area of Circle Using Function & Defining Constant.

`#include<stdio.h>#include<conio.h>#define PI 3.14159float carea(float);void main(){  float radius;  printf("Enter Radius:");  scanf("%f",&radius);  carea(radius);  getch();}float carea(float radius){  float area;  area=PI*radius*radius;  printf("Area= %f",area);}`

## C Program to Find Area of Circle By Defining Symbolic Constant.

`#include<stdio.h>#include<conio.h>#define PI 3.14159void main(){  float radius, area;  printf("Enter Radius:");  scanf("%f",&radius);  area=PI*radius*radius;  printf("Area=%f",area);  getch();}`