123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
TO FIND SUM OF GIVEN INTEGER UNTIL WILL GET SINGLE DIGIT WITHOUT USING ANY CONDITIONAL STATEMENT.

--------------------------------------------------------------------------------

Description : TO FIND THE SUM OF GIVEN INTEGER UNTIL SINGLE DIGIT


# include <stdio.h>
# include <conio.h>
main()
{ int number;
clrscr();

printf("enter the value for n<BR>);
scnaf("%d",&number);

/* MY FIRST LOGIC*/
printf("%d",(number-1)%9+1);

/* MY SECOND LOGIC*/
printf("%d",9-((18-number%9)/9 * 9));

/* MY THIRD LOGIC */
printf("%d",n%9+(9-n%9)/9 * 9);

getch();
}

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG