CrazyEngineers Forum
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering


Advertisements
Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)
Old 6th January 2009, 11:55 PM
CE - Newbie
 
Join Date: 6th January 2009
I'm a Crazy Electrical Engineer
Posts: 9
Default Help me with C programs

Write a program that outputs all perfect numbers less than 1000

Write a program that inputs two fractions in the form a/b and c/d , and outputs their sum in the form p/q cancelled down to its simplest form ?

Everyone - please enclose the code in [code] ... [ /code ] tags

thank you
abbd1990 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote


  #2 (permalink)
Old 7th January 2009, 12:04 AM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
I'm a Crazy Electrical Engineer
Location: Terra-Firma
Posts: 8,437
Send a message via Yahoo to The_Big_K
Default Re: help me with my c programmes

Hi, How about showing us your efforts?
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)
Old 7th January 2009, 02:33 PM
CE - Newbie
 
Join Date: 6th January 2009
I'm a Crazy Electrical Engineer
Posts: 9
Default Re: Help me with C programs

i can't solve those two programmes so that i post them here
abbd1990 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)
Old 7th January 2009, 03:01 PM
CE - Star
CEoM March '09
 
shalini_goel14's Avatar
 
Join Date: 12th March 2008
I'm a Crazy Computer Science Engineer
Location: India
Posts: 2,050
Default Re: Help me with C programs

Quote:
Originally Posted by abbd1990 View Post
i can't solve those two programmes so that i post them here
ok, not a problem. C users will post them for you here . By the way will Java programs work for you?
__________________
"No sound in this world can be louder than silence,
Those who can't understand your silence, can never understand your words!"
Life is a Challenge ! Face it
shalini_goel14 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)
Old 7th January 2009, 03:06 PM
ash
Moderator
 
ash's Avatar
 
Join Date: 12th July 2007
I'm a Crazy Communications Engineer
Location: IIUM, Malaysia
Posts: 3,291
Default Re: Help me with C programs

What biggie meant was, can you try typing the basic C structure first (eg the "#include" preprocessor directive)? Then we can see what area you are struggling at You'll learn better if you show us your attempts.

Unless, you have no clue at all?
__________________

Keep it simple. Keep it real.
| New to CE? Click here! |
Need help? PM or mail at ash{at]crazyengineers{dot]com || Don't forget to hover at http://blog.ashytized.net !
ash is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)
Old 7th January 2009, 03:09 PM
Good Administrator
 
The_Big_K's Avatar
 
Join Date: 26th November 2005
I'm a Crazy Electrical Engineer
Location: Terra-Firma
Posts: 8,437
Send a message via Yahoo to The_Big_K
Default Re: Help me with C programs

I only wanted him to try. Once you know the formula for generating perfect numbers; rest is cakewalk.

I'd still want him to post the incorrect program and ask CEans to guide him than looking for a ready-made program.
The_Big_K is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)
Old 7th January 2009, 03:12 PM
CE - Star
CEoM March '09
 
shalini_goel14's Avatar
 
Join Date: 12th March 2008
I'm a Crazy Computer Science Engineer
Location: India
Posts: 2,050
Default Re: Help me with C programs

Quote:
Originally Posted by The_Big_K View Post
I only wanted him to try. Once you know the formula for generating perfect numbers; rest is cakewalk.

I'd still want him to post the incorrect program and ask CEans to guide him than looking for a ready-made program.
Even I also don't wanted to give him/her ready made program but I don't even want to give him/her a bad impression from this forum in the starting itself. I want him/her to be more active.
__________________
"No sound in this world can be louder than silence,
Those who can't understand your silence, can never understand your words!"
Life is a Challenge ! Face it
shalini_goel14 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)
Old 7th January 2009, 06:48 PM
CE - Regular Member
 
prakash.athani's Avatar
 
Join Date: 30th June 2008
I'm a Crazy Computer Science & IT Engineer
Posts: 53
Default Re: Help me with C programs

Hey abbd1990, check these two small programs. Are these two what you wanted?


Quote:
Write a program that outputs all perfect numbers less than 1000
Code:
/*
C program to display all perfect numbers less than 1000
*/
#include <stdio.h>
#include <conio.h>
 
int main() {
 
              int i,j,num,sum;
              clrscr(); // To clear the screen
 
              printf("The perfect numbers less than 1000 are:");
              for(i=1;i<1000;i++) {
                     num=i;
                     sum=0;
 
                     for(j=1;j<num;j++) {
                               if(num%j==0)
                                      sum=sum+j;
                               }
                     }
 
                     if(sum==num)
                               printf("\n%d",num);
             }
             getch(); 
             return 0;
}
Quote:
Write a program that inputs two fractions in the form a/b and c/d , and outputs their sum in the form p/q cancelled down to its simplest form ?
Code:
/*
C program to accept two fractions in the form a/b and c/d and display 
their sum in the form p/q cancelled down to its simplest form
*/
 
#include <stdio.h>
#include <conio.h>
 
int main() {
 
              int nr,nr1,nr2,dr,dr1,dr2,i;
              char nrsign=' ',drsign=' ';
 
              clrscr(); //To clear the screen
 
              printf("\nFirst fraction :");
              printf("\n\tInput Numerator:");
              scanf("%d",&nr1);
              printf("\n\tInput Denominator:");
              scanf("%d",&dr1);
              printf("\nSecond fraction :");
              printf("\n\tInput Numerator:");
              scanf("%d",&nr2); 
              printf("\n\tInput Denominator:");
              scanf("%d",&dr2);
              printf("\nYour Inputs:");
              printf("\n\tFirst fraction : %d/%d",nr1,dr1);
              printf("\n\tSecond fraction : %d/%d",nr2,dr2);
 
              nr=nr1*dr2+nr2*dr1;
              dr=dr1*dr2;
 
              if(nr<0) {
                          nrsign='-';
                          nr=-nr;
              }
              if(dr<0) { 
                          drsign='-';
                          dr=-dr;
              }
 
              i=2;
              while(i<=dr){
 
                          if(nr%i==0 && dr%i==0){
                                  nr=nr/i;
                                  dr=dr/i;
                                  i=2;
                          }
                          else i=i+1;
              }
 
              printf("\nResult : %c%d /%c%d",nrsign,nr,drsign,dr);
              getch();
              return 0;
}

Last edited by prakash.athani; 7th January 2009 at 07:13 PM.
prakash.athani is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)
Old 8th January 2009, 10:48 PM
CE - Regular Member
 
Ashutosh_shukla's Avatar
 
Join Date: 16th November 2008
I'm a Crazy Computer Science & Engineering Engineer
Location: India
Posts: 75
Send a message via Yahoo to Ashutosh_shukla
Default Re: Help me with C programs

Hey buddy you got the code but if you would have tried and posted incorrect code we all would have been much more happy anyways welcome to the forum and we hope better efforts from those joining in but if you have any problem we are always there to help you
__________________
Ashutosh_shukla is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)
Old 10th January 2009, 04:21 PM
CE - Newbie
 
Join Date: 6th January 2009
I'm a Crazy Electrical Engineer
Posts: 9
Default Re: Help me with C programs

thanks very much my friends for your kind help
abbd1990 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Must-Have Free Windows Programs [Downloads] CE-InFocus CE - InFocus 0 31st December 2008 07:30 AM
Empathy Password-Protects Your Windows (Home) Programs [Featured Windows Download] CE-InFocus CE - InFocus 0 8th December 2008 10:31 PM
Programs or language used in Artificial Intelligence prabhat kumar Computer Science & IT Engineering 2 26th July 2008 11:13 PM
Computer programs. . . help please! KINETIC_JOULES Computer Science & IT Engineering 3 18th July 2008 09:00 AM
MBA programs victornil CE - Careers | Jobs | Higher Education 1 14th May 2008 12:49 PM


All times are GMT +6.5. The time now is 02:14 AM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.0
Member comments are owned by the poster. Copyright © 2005-2009 CrazyEngineers.com. All rights reserved.

Advertisements